From 524655c48631f3fe872b5b38048a29f767e601ee Mon Sep 17 00:00:00 2001 From: Filip W Date: Wed, 26 May 2021 21:27:35 +0200 Subject: [PATCH] avoid NRE when document is null --- src/OmniSharp.Roslyn.CSharp/Helpers/LocationExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OmniSharp.Roslyn.CSharp/Helpers/LocationExtensions.cs b/src/OmniSharp.Roslyn.CSharp/Helpers/LocationExtensions.cs index ef15b41265..8f380fddb4 100644 --- a/src/OmniSharp.Roslyn.CSharp/Helpers/LocationExtensions.cs +++ b/src/OmniSharp.Roslyn.CSharp/Helpers/LocationExtensions.cs @@ -42,7 +42,7 @@ static SourceText GetSourceText(Location location, IEnumerable documen if (hasMappedPath) { SourceText source = null; - if (documents != null && documents.FirstOrDefault(d => d.TryGetText(out source)) != null) + if (documents != null && documents.FirstOrDefault(d => d != null && d.TryGetText(out source)) != null) { // we have a mapped document that exists in workspace return source;