From 55725a6ccac5df21a4d8fd6cf0d7be399e77f711 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Wed, 8 Nov 2023 07:54:55 -0600 Subject: [PATCH] Update to avoid NPE if used without a callback (e.g., scheduled process) --- .../general/LoadInitialRecordsStep.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/general/LoadInitialRecordsStep.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/general/LoadInitialRecordsStep.java index 90c6e74c..7055a6b7 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/general/LoadInitialRecordsStep.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/processes/implementations/general/LoadInitialRecordsStep.java @@ -49,14 +49,17 @@ public class LoadInitialRecordsStep implements BackendStep @Override public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException { - ///////////////////////////////////////////////////////////////////////////////////////////////// - // basically this is a no-op... we Just need a backendStep to be the first step in the process // - // but, while we're here, go ahead and put the query filter in the payload as a value, in case // - // someone else wants it (see BulkDelete) // - ///////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////////// + // basically this is a no-op... sometimes we just need a backendStep to be the first step in a process. // + // While we're here, go ahead and put the query filter in the payload as a value - this is needed for // + // processes that have a screen before their first backend step (why is this needed? not sure, but is) // + ////////////////////////////////////////////////////////////////////////////////////////////////////////// runBackendStepInput.getAsyncJobCallback().updateStatus("Loading records"); - QQueryFilter queryFilter = runBackendStepInput.getCallback().getQueryFilter(); - runBackendStepOutput.addValue("queryFilterJson", JsonUtils.toJson(queryFilter)); + if(runBackendStepInput.getCallback() != null) + { + QQueryFilter queryFilter = runBackendStepInput.getCallback().getQueryFilter(); + runBackendStepOutput.addValue("queryFilterJson", JsonUtils.toJson(queryFilter)); + } }