From 10f35489c326b768bfbd8b84681f7f3ebc9bc57e Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Thu, 5 Dec 2024 16:24:54 +0530 Subject: [PATCH] Null Handling --- app/src/org/commcare/tasks/EntityLoaderHelper.kt | 11 +++++++---- app/src/org/commcare/tasks/EntityLoaderTask.java | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/org/commcare/tasks/EntityLoaderHelper.kt b/app/src/org/commcare/tasks/EntityLoaderHelper.kt index e55c75354..d4b40aeaf 100644 --- a/app/src/org/commcare/tasks/EntityLoaderHelper.kt +++ b/app/src/org/commcare/tasks/EntityLoaderHelper.kt @@ -38,12 +38,15 @@ class EntityLoaderHelper( /** * Loads and prepares a list of entities derived from the given nodeset */ - fun loadEntities(nodeset: TreeReference): Pair>, List> { + fun loadEntities(nodeset: TreeReference): Pair>, List>? { val references = factory.expandReferenceList(nodeset) val entities = loadEntitiesWithReferences(references) - factory.prepareEntities(entities) - factory.printAndClearTraces("build") - return Pair>, List>(entities, references) + entities?.let { + factory.prepareEntities(entities) + factory.printAndClearTraces("build") + return Pair>, List>(entities, references) + } + return null } diff --git a/app/src/org/commcare/tasks/EntityLoaderTask.java b/app/src/org/commcare/tasks/EntityLoaderTask.java index 2681b3783..2f4b6ac58 100644 --- a/app/src/org/commcare/tasks/EntityLoaderTask.java +++ b/app/src/org/commcare/tasks/EntityLoaderTask.java @@ -59,6 +59,10 @@ protected void onPostExecute(Pair>, List