summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-diagnostic-sink.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/compiler-core/slang-diagnostic-sink.cpp b/source/compiler-core/slang-diagnostic-sink.cpp
index 34a3c4968..85c7792c0 100644
--- a/source/compiler-core/slang-diagnostic-sink.cpp
+++ b/source/compiler-core/slang-diagnostic-sink.cpp
@@ -405,10 +405,13 @@ static void formatDiagnostic(
HumaneSourceLoc humaneLoc;
const auto sourceLoc = diagnostic.loc;
{
- sourceView = sourceManager->findSourceViewRecursively(sourceLoc);
- if (sourceView)
+ if (sourceManager)
{
- humaneLoc = sourceView->getHumaneLoc(sourceLoc);
+ sourceView = sourceManager->findSourceViewRecursively(sourceLoc);
+ if (sourceView)
+ {
+ humaneLoc = sourceView->getHumaneLoc(sourceLoc);
+ }
}
formatDiagnostic(humaneLoc, diagnostic, sink->getFlags(), sb);
@@ -418,7 +421,7 @@ static void formatDiagnostic(
while (currentView && currentView->getInitiatingSourceLoc().isValid() && currentView->getSourceFile()->getPathInfo().type == PathInfo::Type::TokenPaste)
{
- SourceView* initiatingView = sourceManager->findSourceView(currentView->getInitiatingSourceLoc());
+ SourceView* initiatingView = sourceManager ? sourceManager->findSourceView(currentView->getInitiatingSourceLoc()) : nullptr;
if (initiatingView == nullptr)
{
break;