From 2ed29be0729085a2d3b8514c2d60f136927bb66f Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 17 Nov 2019 22:41:31 +0000 Subject: [PATCH] selected component can be null when closing a tab --- .../main/groovy/com/muwire/gui/ChatNotificator.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gui/src/main/groovy/com/muwire/gui/ChatNotificator.groovy b/gui/src/main/groovy/com/muwire/gui/ChatNotificator.groovy index 4139237e..e98c5b2a 100644 --- a/gui/src/main/groovy/com/muwire/gui/ChatNotificator.groovy +++ b/gui/src/main/groovy/com/muwire/gui/ChatNotificator.groovy @@ -24,6 +24,12 @@ class ChatNotificator { void serverTabChanged(JTabbedPane source) { JPanel panel = source.getSelectedComponent() + if (panel == null) { + currentServerTab = null + currentRoomTab = null + return + } + String mvcId = panel.getClientProperty("mvcId") def group = groupManager.getGroups().get(mvcId) JTabbedPane childPane = panel.getClientProperty("childPane") @@ -40,6 +46,10 @@ class ChatNotificator { void roomTabChanged(JTabbedPane source) { JPanel panel = source.getSelectedComponent() + if (panel == null) { + currentRoomTab = null + return + } currentRoomTab = panel.getClientProperty("mvcId") roomsWithMessages.remove(currentRoomTab) updateBadge()