← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15122: Case entry, no such element vulnerability fix

 

------------------------------------------------------------
revno: 15122
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-30 13:15:01 +0200
message:
  Case entry, no such element vulnerability fix
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java	2014-04-12 12:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java	2014-04-30 11:15:01 +0000
@@ -301,16 +301,18 @@
 
             Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( entityInstance,
                 program, ProgramInstance.STATUS_ACTIVE );
-            ProgramInstance programIntance = null;
-            if ( programInstances != null )
+            
+            ProgramInstance programInstance = null;
+            
+            if ( programInstances != null && !programInstances.isEmpty() )
             {
-                programIntance = programInstances.iterator().next();
+                programInstance = programInstances.iterator().next();
             }
             if ( trackedEntityForm != null && trackedEntityForm.getDataEntryForm() != null )
             {
                 customRegistrationForm = trackedEntityFormService.prepareDataEntryFormForAdd( trackedEntityForm
                     .getDataEntryForm().getHtmlCode(), trackedEntityForm.getProgram(), healthWorkers, entityInstance,
-                    programIntance, i18n, format );
+                    programInstance, i18n, format );
             }
         }