Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #282 from losttech/fixes/InstanceAttributesNull
Browse files Browse the repository at this point in the history
Fixes NullReferenceException when trying to access InstanceInfo.InstanceAttributes
  • Loading branch information
Mikhail Arkhipov authored Oct 19, 2018
2 parents 45f8796 + 7816414 commit 6d4659f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Analysis/Engine/Impl/Values/InstanceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.PythonTools.Analysis.Analyzer;
using Microsoft.PythonTools.Analysis.Infrastructure;
using Microsoft.PythonTools.Interpreter;
using Microsoft.PythonTools.Parsing;
using Microsoft.PythonTools.Parsing.Ast;
Expand Down Expand Up @@ -93,9 +94,9 @@ private static void MergeTypes(Dictionary<string, IAnalysisSet> res, string key,
}

public IReadOnlyDictionary<string, VariableDef> InstanceAttributes
=> _instanceAttrs.ToDictionary(k => k.Key, v => v.Value);
=> _instanceAttrs.MaybeEnumerate().ToDictionary(k => k.Key, v => v.Value);
IReadOnlyDictionary<string, IVariableDefinition> IInstanceInfo.InstanceAttributes
=> InstanceAttributes.ToDictionary(kvp => kvp.Key, kvp => kvp.Value as IVariableDefinition);
=> _instanceAttrs.MaybeEnumerate().ToDictionary(kvp => kvp.Key, kvp => kvp.Value as IVariableDefinition);

public PythonAnalyzer ProjectState => ClassInfo.AnalysisUnit.State;

Expand Down

0 comments on commit 6d4659f

Please sign in to comment.