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 9ff7958e8712..7e2dc6ce5c81 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 @@ -1010,8 +1010,9 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement if (myParentScheme instanceof TemporaryParent) { String parentName = ((TemporaryParent)myParentScheme).getParentName(); EditorColorsScheme newParent = nameResolver.apply(parentName); - assert newParent != null : "Can not resolve '" + parentName + "' color scheme."; - assert newParent instanceof ReadOnlyColorsScheme : "Resolved parent color scheme must be read-only."; + if (newParent == null || !(newParent instanceof ReadOnlyColorsScheme)) { + throw new InvalidDataException(parentName); + } myParentScheme = newParent; } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java index bc0128f710e7..6acc513d1d13 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java @@ -22,6 +22,9 @@ import com.intellij.configurationStore.SchemeDataHolder; import com.intellij.configurationStore.SchemeExtensionProvider; import com.intellij.ide.WelcomeWizardUtil; import com.intellij.ide.ui.LafManager; +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.ApplicationImpl; @@ -41,6 +44,7 @@ import com.intellij.openapi.options.SchemeManagerFactory; import com.intellij.openapi.options.SchemeState; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; +import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.ComponentTreeEventDispatcher; import com.intellij.util.JdomKt; @@ -52,10 +56,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import java.util.*; import java.util.function.Function; @State( @@ -190,7 +191,16 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers private void resolveLinksToBundledSchemes() { for (EditorColorsScheme scheme : mySchemeManager.getAllSchemes()) { if (scheme instanceof AbstractColorsScheme && !(scheme instanceof ReadOnlyColorsScheme)) { - ((AbstractColorsScheme)scheme).resolveParent(name -> mySchemeManager.findSchemeByName(name)); + try { + ((AbstractColorsScheme)scheme).resolveParent(name -> mySchemeManager.findSchemeByName(name)); + } + catch (InvalidDataException e) { + String message = "Color scheme '" + scheme.getName() + "'" + + " points to incorrect or non-existent default (base) scheme " + + e.getMessage(); + Notifications.Bus.notify( + new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "Incompatible color scheme", message, NotificationType.ERROR)); + } } } }