Browse Source

Fix NullReferenceException in type analysis.

Closes #393, #386, #403.
pull/426/merge
Daniel Grunwald 11 years ago
parent
commit
f538d20de5
  1. 2
      ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs
  2. 6
      ICSharpCode.Decompiler/Tests/TypeAnalysisTests.cs

2
ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs

@ -539,6 +539,8 @@ namespace ICSharpCode.Decompiler.ILAst
if (forceInferChildren) if (forceInferChildren)
InferTypeForExpression(expr.Arguments[1], typeSystem.Int32); InferTypeForExpression(expr.Arguments[1], typeSystem.Int32);
TypeReference type = NumericPromotion(InferTypeForExpression(expr.Arguments[0], null)); TypeReference type = NumericPromotion(InferTypeForExpression(expr.Arguments[0], null));
if (type == null)
return null;
TypeReference expectedInputType = null; TypeReference expectedInputType = null;
switch (type.MetadataType) { switch (type.MetadataType) {
case MetadataType.Int32: case MetadataType.Int32:

6
ICSharpCode.Decompiler/Tests/TypeAnalysisTests.cs

@ -150,4 +150,10 @@ public class TypeAnalysisTests
{ {
return Math.Abs(a - b); return Math.Abs(a - b);
} }
public void Bug393(int valuePos)
{
if ((0x2A >> (valuePos++)) == 0)
return;
}
} }

Loading…
Cancel
Save