From 4f8893470727cfe16e35d737671e59bb4407dc49 Mon Sep 17 00:00:00 2001 From: Nikolay Chashnikov Date: Mon, 3 Aug 2020 16:57:57 +0300 Subject: [PATCH] [platform] report assertion instead of failing with NPE if markCurrentCommandAsGlobal is called not inside command This is a temporary workaround for KT-40787. GitOrigin-RevId: f4b65d9df9bdd90ccf7ab449ce9cedd2c3adff0a --- .../com/intellij/openapi/command/impl/UndoManagerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoManagerImpl.java index 1396c19d7773..bac8125fc1d5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoManagerImpl.java @@ -291,6 +291,10 @@ public class UndoManagerImpl extends UndoManager { } public void markCurrentCommandAsGlobal() { + if (myCurrentMerger == null) { + LOG.error("Must be called inside command"); + return; + } myCurrentMerger.markAsGlobal(); }