IDEMPIERE-5276 : NPE on MInfoWindow.get (#1303)

This commit is contained in:
Nicolas Micoud 2022-04-26 10:42:55 +02:00 committed by GitHub
parent f784d469b4
commit 00c112b263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -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 */ /** Cache */
private static ImmutablePOCache<String,MInfoWindow> s_cache = new ImmutablePOCache<String,MInfoWindow>(Table_Name, 20); private static ImmutablePOCache<String,MInfoWindow> s_cache = new ImmutablePOCache<String,MInfoWindow>(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 * return MInfoWindow if the current role can access to the specified info window ; otherwise return null
* */ * */
public static MInfoWindow get(int infoWindowID, String trxName) { public static MInfoWindow get(int infoWindowID, String trxName) {
MInfoWindow iw = getInfoWindow(infoWindowID); MInfoWindow iw = getInfoWindow(infoWindowID);
Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID());
if (access != null && access.booleanValue()) { if (iw != null) {
if (!Util.isEmpty(trxName, true)) Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID());
iw = new MInfoWindow(iw, trxName); if (access != null && access.booleanValue()) {
return iw; if (!Util.isEmpty(trxName, true))
iw = new MInfoWindow(iw, trxName);
return iw;
}
} }
return null; return null;
} }