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
get { get {
ResolveResult rr = this.constantValue; ResolveResult rr = this.constantValue;
if (rr == null) { if (rr == null) {
if (unresolved == null) IConstantValue unresolvedCV = ((IUnresolvedField)unresolved).ConstantValue;
return null; if (unresolvedCV != null)
rr = ((IUnresolvedField)unresolved).ConstantValue.Resolve(context); rr = unresolvedCV.Resolve(context);
else
rr = ErrorResolveResult.UnknownError;
this.constantValue = rr; this.constantValue = rr;
} }
return rr.ConstantValue; return rr.ConstantValue;

Loading…
Cancel
Save