← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9741: Null check

 

------------------------------------------------------------
revno: 9741
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-05 21:05:35 +0200
message:
  Null check
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.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/patient/GetPatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-02-02 10:34:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/GetPatientAction.java	2013-02-05 19:05:35 +0000
@@ -166,10 +166,10 @@
         else
         {
             Program program = programService.getProgram( programId );
-            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program,
-                false );
+            Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program, false );
 
             ProgramInstance programInstance = null;
+            
             if ( programInstances.iterator().hasNext() )
             {
                 programInstance = programInstances.iterator().next();
@@ -177,8 +177,12 @@
             
             PatientRegistrationForm patientRegistrationForm = patientRegistrationFormService
                 .getPatientRegistrationForm( program );
-            customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd( patientRegistrationForm
-                .getDataEntryForm().getHtmlCode(), healthWorkers, patient, programInstance, i18n, format );
+            
+            if ( patientRegistrationForm != null )
+            {
+                customRegistrationForm = patientRegistrationFormService.prepareDataEntryFormForAdd( patientRegistrationForm
+                    .getDataEntryForm().getHtmlCode(), healthWorkers, patient, programInstance, i18n, format );
+            }
         }
 
         if ( customRegistrationForm == null )
@@ -207,6 +211,7 @@
             for ( PatientAttribute patientAttribute : patientAttributes )
             {
                 PatientAttributeGroup attributeGroup = patientAttribute.getPatientAttributeGroup();
+                
                 if ( attributeGroup != null )
                 {
                     if ( attributeGroupsMap.containsKey( attributeGroup ) )