From a2fbff9f72eb9440961b0353d15e4928769910b5 Mon Sep 17 00:00:00 2001 From: bdovaz Date: Sat, 27 Sep 2025 15:46:47 +0200 Subject: [PATCH] fix: handle NRE --- .../ManagedReference/Visitors/SymbolVisitorAdapter.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs b/src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs index 771bc40a11a..d32cea12e2f 100644 --- a/src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs +++ b/src/Docfx.Dotnet/ManagedReference/Visitors/SymbolVisitorAdapter.cs @@ -731,6 +731,12 @@ string ResolveCode(string source) ? Path.GetDirectoryName(Path.GetFullPath(Path.Combine(EnvironmentContext.BaseDirectory, sourcePath))) : null); + if (basePath == null) + { + Logger.LogWarning($"Source file '{source}' not found.", code: "CodeNotFound"); + return null; + } + var path = Path.GetFullPath(Path.Combine(basePath, source)); if (!File.Exists(path)) {