From 6ba8804683a0dee27aa686c2cf42a80020012fdc Mon Sep 17 00:00:00 2001 From: mherman22 Date: Tue, 2 Jan 2024 22:11:55 +0300 Subject: [PATCH] Fix NPE on CohortReportFormController.onSubmit --- .../web/controller/report/CohortReportFormController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/omod/src/main/java/org/openmrs/web/controller/report/CohortReportFormController.java b/omod/src/main/java/org/openmrs/web/controller/report/CohortReportFormController.java index b2445fd..cfbb427 100644 --- a/omod/src/main/java/org/openmrs/web/controller/report/CohortReportFormController.java +++ b/omod/src/main/java/org/openmrs/web/controller/report/CohortReportFormController.java @@ -315,6 +315,11 @@ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse Document xml = db.parse(new InputSource(new StringReader( "" + data))); Node node = findChild(xml, "reportSchema"); + + if(node == null) { + return null; + } + node = findChild(node, "dataSets"); Element dsd = xml.createElement("dataSetDefinition"); dsd.setAttribute("name", "cohorts");