From 2d06047049a1e32be02f2f69d37ece285665fa26 Mon Sep 17 00:00:00 2001 From: hengsin Date: Sun, 8 Mar 2020 17:18:31 +0800 Subject: [PATCH] IDEMPIERE-4195 Add NPE check to SchedulerStateEditor --- .../webui/scheduler/SchedulerStateEditor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/scheduler/SchedulerStateEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/scheduler/SchedulerStateEditor.java index 26f94d2f3b..a6f92158d2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/scheduler/SchedulerStateEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/scheduler/SchedulerStateEditor.java @@ -140,7 +140,7 @@ public class SchedulerStateEditor extends WEditor { } private int getAD_Scheduler_ID() { - return gridTab.getRecord_ID(); + return gridTab != null ? gridTab.getRecord_ID() : 0; } /** @@ -152,7 +152,7 @@ public class SchedulerStateEditor extends WEditor { if (schedulerState == AdempiereServerMgr.SERVER_STATE_NOT_SCHEDULE) { ADWindow adwindow = ADWindow.findADWindow(getComponent()); if (adwindow != null) { - if (gridTab.isNew() || gridTab.needSave(false, false)) { + if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) { adwindow.getADWindowContent().onSave(true, false, new Callback() { @Override public void onCallback(Boolean result) { @@ -171,7 +171,7 @@ public class SchedulerStateEditor extends WEditor { } else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STARTED) { ADWindow adwindow = ADWindow.findADWindow(getComponent()); if (adwindow != null) { - if (gridTab.isNew() || gridTab.needSave(false, false)) { + if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) { adwindow.getADWindowContent().onSave(true, false, new Callback() { @Override public void onCallback(Boolean result) { @@ -186,7 +186,7 @@ public class SchedulerStateEditor extends WEditor { } else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STOPPED) { ADWindow adwindow = ADWindow.findADWindow(getComponent()); if (adwindow != null) { - if (gridTab.isNew() || gridTab.needSave(false, false)) { + if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) { adwindow.getADWindowContent().onSave(true, false, new Callback() { @Override public void onCallback(Boolean result) { @@ -261,7 +261,7 @@ public class SchedulerStateEditor extends WEditor { */ @Override public void setReadWrite(boolean readWrite) { - GridField descriptionField = gridTab.getField("Description"); + GridField descriptionField = gridTab != null ? gridTab.getField("Description") : null; if (descriptionField != null) getComponent().setEnabled(descriptionField.isEditable(true)); else