Skip to content

Commit 8da92fb

Browse files
committed
Handling invalid editor states from preview releases (#1636)
1 parent 1d885f6 commit 8da92fb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ This document provides a high-level view of the changes introduced by release.
77
[[releasenotes]]
88
== Release notes
99

10+
=== 0.42.2
11+
12+
- Handling invalid editor states from preview releases (#1636)
13+
1014
=== 0.42.1
1115

1216
- Reworking the changes for EAP, restoring preview and menu bar functionality (#1636)

src/main/java/org/asciidoc/intellij/ui/SplitFileEditor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.asciidoc.intellij.toolbar.AsciiDocToolbarPanel;
2323
import org.jetbrains.annotations.NotNull;
2424
import org.jetbrains.annotations.Nullable;
25+
import org.jruby.util.ResourceException;
2526

2627
import javax.swing.*;
2728
import java.awt.*;
@@ -202,7 +203,12 @@ public void setState(@NotNull FileEditorState state) {
202203
mySecondEditor.setState(compositeState.getSecondState());
203204
}
204205
if (compositeState.getSplitLayout() != null) {
205-
mySplitEditorLayout = SplitEditorLayout.valueOf(compositeState.getSplitLayout());
206+
try {
207+
mySplitEditorLayout = SplitEditorLayout.valueOf(compositeState.getSplitLayout());
208+
} catch (IllegalArgumentException ignore) {
209+
// found an obsolete or old value, using the default value
210+
mySplitEditorLayout = AsciiDocApplicationSettings.getInstance().getAsciiDocPreviewSettings().getSplitEditorLayout();
211+
}
206212
invalidateLayout();
207213
}
208214
}

0 commit comments

Comments
 (0)