Browse Source

Fix NullReferenceException in DefaultResolvedField.ConstantValue when the field is not a constant.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
92c8bd671a
  1. 8
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedField.cs

8
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedField.cs

@ -51,9 +51,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -51,9 +51,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get {
ResolveResult rr = this.constantValue;
if (rr == null) {
if (unresolved == null)
return null;
rr = ((IUnresolvedField)unresolved).ConstantValue.Resolve(context);
IConstantValue unresolvedCV = ((IUnresolvedField)unresolved).ConstantValue;
if (unresolvedCV != null)
rr = unresolvedCV.Resolve(context);
else
rr = ErrorResolveResult.UnknownError;
this.constantValue = rr;
}
return rr.ConstantValue;

Loading…
Cancel
Save