Skip to content

Commit 5fb240e

Browse files
matthewseamanbnbarham
authored andcommitted
Avoid crash when querying in non-visible files
1 parent 9a27320 commit 5fb240e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/IndexStoreDB_Index/SymbolIndex.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@ bool SymbolIndexImpl::foreachSymbolInFilePath(CanonicalFilePathRef filePath,
479479
IDCode providerCode = provider.ProviderCode;
480480
if (provider.FileCode == filePathCode) {
481481
auto record = createVisibleProviderForCode(providerCode, reader);
482+
if (!record) {
483+
continue;
484+
}
482485
didFinish = record->foreachCoreSymbolData([&](StringRef usr,
483486
StringRef name,
484487
SymbolInfo info,
@@ -517,6 +520,9 @@ bool SymbolIndexImpl::foreachSymbolOccurrenceInFilePath(CanonicalFilePathRef fil
517520
IDCode providerCode = provider.ProviderCode;
518521
if (provider.FileCode == filePathCode) {
519522
auto record = createVisibleProviderForCode(providerCode, reader);
523+
if (!record) {
524+
continue;
525+
}
520526
didFinish = record->foreachSymbolOccurrence(Receiver);
521527

522528
return false;

0 commit comments

Comments
 (0)