From 4f7c5886d0302bf05ba67612b73777c6b32bbf33 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Thu, 31 May 2018 18:43:20 +0300 Subject: [PATCH] IDEA-189500 Search does not work Avoid NPE when caret field is suddenly null --- .../src/com/intellij/find/impl/FindPopupPanel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java index 49a4e3249457..1e0b3b261223 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindPopupPanel.java @@ -206,7 +206,11 @@ public class FindPopupPanel extends JBPanel implements FindUI { } showPoint = new RelativePoint(parent, new Point((parent.getSize().width - getPreferredSize().width) / 2, height)); } - mySearchComponent.selectAll(); + ApplicationManager.getApplication().invokeLater(() -> { + if (mySearchComponent.getCaret() != null) { + mySearchComponent.selectAll(); + } + }); WindowMoveListener windowListener = new WindowMoveListener(this); myTitlePanel.addMouseListener(windowListener); myTitlePanel.addMouseMotionListener(windowListener);