From 5af9e7de568c9568375a2f94d92b73fdaa18bc0e Mon Sep 17 00:00:00 2001 From: Marcos Gabriel de Oliveira Favaretto Date: Fri, 28 Jul 2023 01:28:08 -0300 Subject: [PATCH] IDEMPIERE-5811 - Fix NPE on event for BroadcastMessages (#1954) --- .../src/org/adempiere/webui/desktop/DefaultDesktop.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index 84fcc975ec..92ce8955cb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -972,12 +972,13 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria @Override public void onEvent(Event event) throws Exception { BroadCastMsg msg = (BroadCastMsg) event.getData(); - + MBroadcastMessage mbMessage = MBroadcastMessage.get(Env.getCtx(), msg.getIntData()); + + if (mbMessage == null) + return; switch (msg.getEventId()) { case BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE: - MBroadcastMessage mbMessage = MBroadcastMessage.get( - Env.getCtx(), msg.getIntData()); String currSession = Integer .toString(Env.getContextAsInt(Env.getCtx(), "AD_Session_ID")); @@ -990,8 +991,6 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria } break; case BroadCastUtil.EVENT_BROADCAST_MESSAGE: - mbMessage = MBroadcastMessage.get( - Env.getCtx(), msg.getIntData()); if (mbMessage.isValidUserforMessage()) { BroadcastMessageWindow messageWindow = new BroadcastMessageWindow(