From b20c35742fef3bdb76f8f8a844a6a55a7bfb17e1 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Sun, 20 Feb 2022 21:54:08 +0100 Subject: Tolerate null schema --- .../src/main/java/ai/vespa/intellij/schema/model/RankProfile.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'integration/intellij/src/main') diff --git a/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/RankProfile.java b/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/RankProfile.java index 10ecde68ff9..05cc08f2bc9 100644 --- a/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/RankProfile.java +++ b/integration/intellij/src/main/java/ai/vespa/intellij/schema/model/RankProfile.java @@ -51,16 +51,18 @@ public class RankProfile { */ public Map parents() { if (parents != null) return parents; + if (owner == null) return Map.of(); // Some code paths do not yet instantiate from a schema return parents = AST.inherits(definition).stream() .map(parentIdentifierAST -> parentIdentifierAST.getPsi().getReference()) .filter(reference -> reference != null) .map(reference -> owner.rankProfiles().get(reference.getCanonicalText())) - .filter(r -> r != null) - .collect(Collectors.toMap(p -> p.name(), p -> p)); + .filter(profile -> profile != null) + .collect(Collectors.toMap(profile -> profile.name(), profile -> profile)); } public List children() { if (children != null) return children; + if (owner == null) return List.of(); // Some code paths do not yet instantiate from a schema return children = children(owner); } -- cgit v1.2.3