From 7dc669807f3cbccc24f559c0847378f98ef4764c Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 18 Mar 2016 18:40:52 +0100 Subject: [PATCH] do not call InjectorUtils.getActiveInjectionSupports() if no `injection` data in the data --- .../plugins/intelliLang/Configuration.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java index ed6e3086a828..fe27cac71b81 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java @@ -228,21 +228,26 @@ public class Configuration extends SimpleModificationTracker implements Persiste @Override public void loadState(final Element element) { myInjections.clear(); - final Map supports = new THashMap(); - for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { - supports.put(support.getId(), support); - } - for (Element child : element.getChildren("injection")){ - final String key = child.getAttributeValue("injector-id"); - final LanguageInjectionSupport support = supports.get(key); - final BaseInjection injection = support == null ? new BaseInjection(key) : support.createInjection(child); - injection.loadState(child); - InjectionPlace[] places = dropKnownInvalidPlaces(injection.getInjectionPlaces()); - if (places != null) { // not all places were removed - injection.setInjectionPlaces(places); - myInjections.get(key).add(injection); + + List injectionElements = element.getChildren("injection"); + if (!injectionElements.isEmpty()) { + final Map supports = new THashMap(); + for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { + supports.put(support.getId(), support); + } + for (Element child : injectionElements) { + final String key = child.getAttributeValue("injector-id"); + final LanguageInjectionSupport support = supports.get(key); + final BaseInjection injection = support == null ? new BaseInjection(key) : support.createInjection(child); + injection.loadState(child); + InjectionPlace[] places = dropKnownInvalidPlaces(injection.getInjectionPlaces()); + if (places != null) { // not all places were removed + injection.setInjectionPlaces(places); + myInjections.get(key).add(injection); + } } } + importPlaces(getDefaultInjections()); }