Skip to content

Commit 43493c4

Browse files
authored
fix: handle NRE (#10827)
1 parent 3a7a2d9 commit 43493c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,12 @@ string ResolveCode(string source)
731731
? Path.GetDirectoryName(Path.GetFullPath(Path.Combine(EnvironmentContext.BaseDirectory, sourcePath)))
732732
: null);
733733

734+
if (basePath == null)
735+
{
736+
Logger.LogWarning($"Source file '{source}' not found.", code: "CodeNotFound");
737+
return null;
738+
}
739+
734740
var path = Path.GetFullPath(Path.Combine(basePath, source));
735741
if (!File.Exists(path))
736742
{

0 commit comments

Comments
 (0)