From 03ea4d73b1607bc02099b92b7c51bd4347d031a4 Mon Sep 17 00:00:00 2001 From: Aleksandra Olemskaia Date: Tue, 7 Jul 2026 13:27:27 +0200 Subject: [PATCH] [settings] IJPL-249562 don't call isModified() before createComponent() in non-modal Settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit isModifiedSafely() was guarding against exceptions thrown by uninitialized configurables, but the real fix is to not call isModified() at all when createComponent() hasn't been called yet. Made isModifiedSafely() an instance method and added an editor.getContent(configurable) != null guard inside it — returns null early if the configurable was never displayed. (cherry picked from commit ce2ee379a3cef595ee8c77fbbe6d7ae368d9a7de) IJ-CR-217470 GitOrigin-RevId: dc3f5d0bc06e6416c1c2afa31371ae14ffef5b90 --- .../openapi/options/newEditor/SettingsEditor.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java index 67a8b4e9b1e8..1064f900091c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/SettingsEditor.java @@ -655,12 +655,14 @@ public final class SettingsEditor extends AbstractEditor implements UiDataProvid /** * Calls {@link Configurable#isModified()} on {@code configurable} and returns the result, - * or {@code null} if the call throws (with a warning logged). - * Some configurables throw before {@link Configurable#createComponent()} has been called — - * e.g. {@code CustomizationConfigurable} NPEs on a null panel, and - * {@code FileEncodingConfigurable} throws {@link AssertionError}. + * or {@code null} if {@link Configurable#createComponent()} has not been called yet + * (i.e. the configurable was never displayed) or if the call throws (with a warning logged). */ - private static @Nullable Boolean isModifiedSafely(@NotNull Configurable configurable) { + private @Nullable Boolean isModifiedSafely(@NotNull Configurable configurable) { + if (editor.getContent(configurable) == null) { + LOG.debug("Configurable " + configurable.getDisplayName() + " was never displayed"); + return null; + } try { return configurable.isModified(); }