Skip to content

Commit

Permalink
Fix #3142: Exception when analyzing source of library with global ass…
Browse files Browse the repository at this point in the history
…embly attributes
  • Loading branch information
siegfriedpammer committed Dec 25, 2023
1 parent 760e7e0 commit 123da88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/AnalyzerEntityTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public abstract class AnalyzerEntityTreeNode : AnalyzerTreeNode, IMemberTreeNode
public override void ActivateItem(System.Windows.RoutedEventArgs e)
{
e.Handled = true;
if (this.Member.MetadataToken.IsNil)
if (this.Member == null || this.Member.MetadataToken.IsNil)
{
MessageBox.Show(Properties.Resources.CannotAnalyzeMissingRef, "ILSpy");
return;
Expand Down
13 changes: 12 additions & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedModuleTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

using System;
using System.Linq;
using System.Windows;

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
Expand Down Expand Up @@ -51,6 +51,17 @@ protected override void LoadChildren()
}
}

public override void ActivateItem(RoutedEventArgs e)
{
e.Handled = true;
if (analyzedModule.PEFile == null)
{
MessageBox.Show(Properties.Resources.CannotAnalyzeMissingRef, "ILSpy");
return;
}
MainWindow.Instance.JumpToReference(analyzedModule.PEFile);
}

public override IEntity Member => null;
}
}

0 comments on commit 123da88

Please sign in to comment.