Skip to content

Commit 5ff02dd

Browse files
committed
fixed NRE when parent module declaration is null
1 parent 6787c16 commit 5ff02dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

RetailCoder.VBE/Inspections/Abstract/InspectionBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ protected bool IsIgnoringInspectionResultFor(IVBComponent component, int line)
116116

117117
protected bool IsIgnoringInspectionResultFor(Declaration declaration, string inspectionName)
118118
{
119-
var isIgnoredAtModuleLevel =
120-
Declaration.GetModuleParent(declaration).Annotations
119+
var module = Declaration.GetModuleParent(declaration);
120+
if (module == null) { return false; }
121+
122+
var isIgnoredAtModuleLevel = module.Annotations
121123
.Any(annotation => annotation.AnnotationType == AnnotationType.IgnoreModule
122124
&& ((IgnoreModuleAnnotation) annotation).IsIgnored(inspectionName));
123125

0 commit comments

Comments
 (0)