diff --git a/platform/configuration-store-impl/src/SchemeManagerImpl.kt b/platform/configuration-store-impl/src/SchemeManagerImpl.kt index bb4a1eb1da08..449d0d723ac5 100644 --- a/platform/configuration-store-impl/src/SchemeManagerImpl.kt +++ b/platform/configuration-store-impl/src/SchemeManagerImpl.kt @@ -913,10 +913,10 @@ class SchemeManagerImpl(val fileSpec: String, override fun getCurrentSchemeName() = currentScheme?.name ?: currentPendingSchemeName private fun processPendingCurrentSchemeName(newScheme: T) { - if (newScheme.name == currentPendingSchemeName) { - setCurrent(newScheme, false) + if (newScheme.name == currentPendingSchemeName) { + setCurrent(newScheme, false) + } } - } override fun removeScheme(schemeName: String) = removeFirstScheme(schemes) {it.name == schemeName} diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index 0f12c4e9ce37..71d2c62bf64e 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -30,6 +30,7 @@ import com.intellij.openapi.options.FontSize; import com.intellij.openapi.options.SchemeManager; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Couple; +import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; import com.intellij.util.JdomKt; import com.intellij.util.PlatformUtils; @@ -302,7 +303,8 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial return getName(); } - public void readExternal(Element parentNode) { + @Override + public void readExternal(@NotNull Element parentNode) { UISettings settings = UISettings.getInstance(); ColorBlindness blindness = settings == null ? null : settings.COLOR_BLINDNESS; myValueReader.setAttribute(blindness == null ? null : blindness.name()); @@ -310,7 +312,12 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial readScheme(parentNode); } else { - for (Element element : parentNode.getChildren(SCHEME_ELEMENT)) { + List children = parentNode.getChildren(SCHEME_ELEMENT); + if (children.isEmpty()) { + throw new InvalidDataException("Scheme is not valid"); + } + + for (Element element : children) { readScheme(element); } }