Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add defensive check for context type location
  • Loading branch information
layomia committed Nov 15, 2021
commit 29d2da4f41ee64d9b546319c5d17e7adee841170
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public Parser(Compilation compilation, in JsonSourceGenerationContext sourceGene
INamedTypeSymbol contextTypeSymbol = (INamedTypeSymbol)compilationSemanticModel.GetDeclaredSymbol(classDeclarationSyntax);
Debug.Assert(contextTypeSymbol != null);

Location contextLocation = contextTypeSymbol.Locations[0];
Location contextLocation = contextTypeSymbol.Locations.Length > 0 ? contextTypeSymbol.Locations[0] : Location.None;

if (!TryGetClassDeclarationList(contextTypeSymbol, out List<string> classDeclarationList))
{
Expand Down