Skip to content

Commit 4cee30f

Browse files
committed
Fixed NPE for default parameters (#412)
1 parent d5a4ccb commit 4cee30f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/com/intellij/lang/jsgraphql/ide/GraphQLValidationAnnotator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.intellij.lang.jsgraphql.schema.GraphQLValidatedSchema;
3131
import com.intellij.lang.jsgraphql.utils.GraphQLUtil;
3232
import com.intellij.openapi.components.ServiceManager;
33-
import com.intellij.openapi.editor.Editor;
3433
import com.intellij.openapi.editor.LogicalPosition;
3534
import com.intellij.openapi.editor.colors.CodeInsightColors;
3635
import com.intellij.openapi.project.Project;
@@ -210,7 +209,9 @@ public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder a
210209
final String currentFileName = GraphQLPsiUtil.getFileName(containingFile);
211210
final Ref<SourceLocation> firstSchemaError = new Ref<>();
212211
for (GraphQLError error : schema.getErrors()) {
213-
SourceLocation firstSourceLocation = error.getLocations().stream().findFirst().orElse(null);
212+
List<SourceLocation> errorLocations = error.getLocations();
213+
SourceLocation firstSourceLocation = errorLocations != null
214+
? errorLocations.stream().findFirst().orElse(null) : null;
214215
if (firstSourceLocation != null && firstSchemaError.isNull()) {
215216
firstSchemaError.set(firstSourceLocation);
216217
}

0 commit comments

Comments
 (0)