From 21bcfbfa17e7a5014f7f09d56b02af6b4ae1aed2 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 7 Dec 2018 19:16:53 +0100 Subject: [PATCH] nullize only after element is successfully read, otherwise our state will be undefined - both myDataHolder and myCodeStyleSettings are null --- .../psi/impl/source/codeStyle/CodeStyleSchemeImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java index 48ebcd651328..a4eccd8d8f42 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeStyleSchemeImpl.java @@ -78,8 +78,10 @@ public class CodeStyleSchemeImpl extends ExternalizableSchemeAdapter implements return myCodeStyleSettings; } + Element element = dataHolder.read(); + // nullize only after element is successfully read, otherwise our state will be undefined - both myDataHolder and myCodeStyleSettings are null myDataHolder = null; - settings = init(myParentSchemeName == null ? null : CodeStyleSchemesImpl.getSchemeManager().findSchemeByName(myParentSchemeName), dataHolder.read()); + settings = init(myParentSchemeName == null ? null : CodeStyleSchemesImpl.getSchemeManager().findSchemeByName(myParentSchemeName), element); dataHolder.updateDigest(this); myParentSchemeName = null; }