Skip to content

Commit a85e5b5

Browse files
Fix a possible NRE in XmlDocumentationElement and wrong nullable annotations in analyzers.
1 parent e5a8542 commit a85e5b5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ICSharpCode.Decompiler/Documentation/XmlDocumentationElement.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ static List<XmlDocumentationElement> CreateElements(IEnumerable<XObject?> childO
193193
if (inheritedFrom != null)
194194
inheritedDocumentation = "<doc>" + inheritedFrom.GetDocumentation() + "</doc>";
195195
}
196-
else
196+
else if (declaringEntity != null)
197197
{
198-
foreach (IMember baseMember in InheritanceHelper.GetBaseMembers((IMember?)declaringEntity, includeImplementedInterfaces: true))
198+
foreach (IMember baseMember in InheritanceHelper.GetBaseMembers((IMember)declaringEntity, includeImplementedInterfaces: true))
199199
{
200200
inheritedDocumentation = baseMember.GetDocumentation();
201201
if (inheritedDocumentation != null)

ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext cont
4545
Debug.Assert(analyzedSymbol is IMethod);
4646

4747
var analyzedMethod = (IMethod)analyzedSymbol;
48-
var analyzedBaseMethod = (IMethod)InheritanceHelper.GetBaseMember(analyzedMethod);
48+
var analyzedBaseMethod = (IMethod?)InheritanceHelper.GetBaseMember(analyzedMethod);
4949
if (analyzedMethod.ParentModule?.MetadataFile == null)
5050
yield break;
5151
var mapping = context.Language
@@ -109,12 +109,12 @@ public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext cont
109109
}
110110
}
111111

112-
bool IsUsedInMethod(IMethod analyzedEntity, IMethod analyzedBaseMethod, IMethod method, AnalyzerContext context)
112+
bool IsUsedInMethod(IMethod analyzedEntity, IMethod? analyzedBaseMethod, IMethod method, AnalyzerContext context)
113113
{
114114
return ScanMethodBody(analyzedEntity, method, analyzedBaseMethod, context.GetMethodBody(method));
115115
}
116116

117-
static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, IMethod analyzedBaseMethod, MethodBodyBlock? methodBody)
117+
static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, IMethod? analyzedBaseMethod, MethodBodyBlock? methodBody)
118118
{
119119
if (methodBody == null || method.ParentModule?.MetadataFile == null)
120120
return false;

0 commit comments

Comments
 (0)