Skip to content

Commit

Permalink
Merge pull request #23 from jp2masa/fixes
Browse files Browse the repository at this point in the history
Fixed KeyNotFoundException in XamlNeedsParentStackCache
  • Loading branch information
kekekeks authored Aug 16, 2020
2 parents 08f167b + 323cffc commit 697a419
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/XamlX/IL/Emitters/ObjectInitializationNodeEmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ class XamlNeedsParentStackCache : Dictionary<IXamlAstNode, bool>
{
public static void Verify(XamlContextBase ctx, IXamlAstNode node)
{
var cache = ctx.GetItem<XamlNeedsParentStackCache>();
// There is no parent stack
if (cache == null)
return;
if (!cache.ContainsKey(node))
if (ctx.TryGetItem<XamlNeedsParentStackCache>(out var cache) && !cache.ContainsKey(node))
throw new XamlLoadException("Node needs parent stack, but one doesn't seem to be provided", node);
}
class ParentStackVisitor : IXamlAstVisitor
Expand Down

0 comments on commit 697a419

Please sign in to comment.