IDEMPIERE-4195 Add NPE check to SchedulerStateEditor

This commit is contained in:
hengsin 2020-03-08 17:18:31 +08:00
parent 61241bb021
commit 2d06047049
1 changed files with 5 additions and 5 deletions

View File

@ -140,7 +140,7 @@ public class SchedulerStateEditor extends WEditor {
} }
private int getAD_Scheduler_ID() { 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) { if (schedulerState == AdempiereServerMgr.SERVER_STATE_NOT_SCHEDULE) {
ADWindow adwindow = ADWindow.findADWindow(getComponent()); ADWindow adwindow = ADWindow.findADWindow(getComponent());
if (adwindow != null) { 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<Boolean>() { adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
@ -171,7 +171,7 @@ public class SchedulerStateEditor extends WEditor {
} else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STARTED) { } else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STARTED) {
ADWindow adwindow = ADWindow.findADWindow(getComponent()); ADWindow adwindow = ADWindow.findADWindow(getComponent());
if (adwindow != null) { 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<Boolean>() { adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
@ -186,7 +186,7 @@ public class SchedulerStateEditor extends WEditor {
} else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STOPPED) { } else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STOPPED) {
ADWindow adwindow = ADWindow.findADWindow(getComponent()); ADWindow adwindow = ADWindow.findADWindow(getComponent());
if (adwindow != null) { 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<Boolean>() { adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
@Override @Override
public void onCallback(Boolean result) { public void onCallback(Boolean result) {
@ -261,7 +261,7 @@ public class SchedulerStateEditor extends WEditor {
*/ */
@Override @Override
public void setReadWrite(boolean readWrite) { public void setReadWrite(boolean readWrite) {
GridField descriptionField = gridTab.getField("Description"); GridField descriptionField = gridTab != null ? gridTab.getField("Description") : null;
if (descriptionField != null) if (descriptionField != null)
getComponent().setEnabled(descriptionField.isEditable(true)); getComponent().setEnabled(descriptionField.isEditable(true));
else else