From 00c112b263e1e793e84219a403e80cabab6a9e5e Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:42:55 +0200 Subject: [PATCH] IDEMPIERE-5276 : NPE on MInfoWindow.get (#1303) --- .../src/org/compiere/model/MInfoWindow.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java index cf5f6f6677..f5836d0e39 100644 --- a/org.adempiere.base/src/org/compiere/model/MInfoWindow.java +++ b/org.adempiere.base/src/org/compiere/model/MInfoWindow.java @@ -48,7 +48,7 @@ public class MInfoWindow extends X_AD_InfoWindow implements ImmutablePOSupport /** * */ - private static final long serialVersionUID = 6723480469706009814L; + private static final long serialVersionUID = -6793583766286122866L; /** Cache */ private static ImmutablePOCache s_cache = new ImmutablePOCache(Table_Name, 20); @@ -221,13 +221,17 @@ public class MInfoWindow extends X_AD_InfoWindow implements ImmutablePOSupport * return MInfoWindow if the current role can access to the specified info window ; otherwise return null * */ public static MInfoWindow get(int infoWindowID, String trxName) { - MInfoWindow iw = getInfoWindow(infoWindowID); - Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID()); - if (access != null && access.booleanValue()) { - if (!Util.isEmpty(trxName, true)) - iw = new MInfoWindow(iw, trxName); - return iw; + MInfoWindow iw = getInfoWindow(infoWindowID); + + if (iw != null) { + Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID()); + if (access != null && access.booleanValue()) { + if (!Util.isEmpty(trxName, true)) + iw = new MInfoWindow(iw, trxName); + return iw; + } } + return null; }