IDEMPIERE-5811 - Fix NPE on event for BroadcastMessages (#1954)

This commit is contained in:
Marcos Gabriel de Oliveira Favaretto 2023-07-28 01:28:08 -03:00 committed by GitHub
parent 3f1367a1f5
commit 5af9e7de56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -972,12 +972,13 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
BroadCastMsg msg = (BroadCastMsg) event.getData(); BroadCastMsg msg = (BroadCastMsg) event.getData();
MBroadcastMessage mbMessage = MBroadcastMessage.get(Env.getCtx(), msg.getIntData());
if (mbMessage == null)
return;
switch (msg.getEventId()) { switch (msg.getEventId()) {
case BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE: case BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE:
MBroadcastMessage mbMessage = MBroadcastMessage.get(
Env.getCtx(), msg.getIntData());
String currSession = Integer String currSession = Integer
.toString(Env.getContextAsInt(Env.getCtx(), .toString(Env.getContextAsInt(Env.getCtx(),
"AD_Session_ID")); "AD_Session_ID"));
@ -990,8 +991,6 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
} }
break; break;
case BroadCastUtil.EVENT_BROADCAST_MESSAGE: case BroadCastUtil.EVENT_BROADCAST_MESSAGE:
mbMessage = MBroadcastMessage.get(
Env.getCtx(), msg.getIntData());
if (mbMessage.isValidUserforMessage()) { if (mbMessage.isValidUserforMessage()) {
BroadcastMessageWindow messageWindow = new BroadcastMessageWindow( BroadcastMessageWindow messageWindow = new BroadcastMessageWindow(