From 92996dd9ea9c5b4a0e42837e2f237ec2af4d064e Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Mon, 24 Jun 2024 20:00:29 +0200 Subject: [PATCH] Handling invalid editor states from preview releases (#1636) --- CHANGELOG.adoc | 4 ++++ .../java/org/asciidoc/intellij/ui/SplitFileEditor.java | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 336473966..371c258c3 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -7,6 +7,10 @@ This document provides a high-level view of the changes introduced by release. [[releasenotes]] == Release notes +=== 0.42.2 + +- Handling invalid editor states from preview releases (#1636) + === 0.42.1 - Reworking the changes for EAP, restoring preview and menu bar functionality (#1636) diff --git a/src/main/java/org/asciidoc/intellij/ui/SplitFileEditor.java b/src/main/java/org/asciidoc/intellij/ui/SplitFileEditor.java index 6d731ca0e..d2d95ac26 100644 --- a/src/main/java/org/asciidoc/intellij/ui/SplitFileEditor.java +++ b/src/main/java/org/asciidoc/intellij/ui/SplitFileEditor.java @@ -202,7 +202,12 @@ public void setState(@NotNull FileEditorState state) { mySecondEditor.setState(compositeState.getSecondState()); } if (compositeState.getSplitLayout() != null) { - mySplitEditorLayout = SplitEditorLayout.valueOf(compositeState.getSplitLayout()); + try { + mySplitEditorLayout = SplitEditorLayout.valueOf(compositeState.getSplitLayout()); + } catch (IllegalArgumentException ignore) { + // found an obsolete or old value, using the default value + mySplitEditorLayout = AsciiDocApplicationSettings.getInstance().getAsciiDocPreviewSettings().getSplitEditorLayout(); + } invalidateLayout(); } }