← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13295: NPE check in getOrganisationUnitsAction

 

------------------------------------------------------------
revno: 13295
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-12-18 09:58:19 +0100
message:
  NPE check in getOrganisationUnitsAction
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.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-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2013-12-09 21:32:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2013-12-18 08:58:19 +0000
@@ -236,7 +236,13 @@
                 }
 
                 int minLevel = rootOrganisationUnits.get( 0 ).getLevel();
-                int maxLevel = organisationUnitService.getOrganisationUnitLevelByLevel( size ).getLevel();
+                int maxLevel = Integer.MAX_VALUE;
+
+                if ( organisationUnitService.getOrganisationUnitLevelByLevel( size ) != null )
+                {
+                    maxLevel = organisationUnitService.getOrganisationUnitLevelByLevel( size ).getLevel();
+                }
+
                 int total = minLevel + offlineOrganisationUnitLevel.getLevel() - 1;
 
                 if ( total > offlineOrganisationUnitLevel.getLevel() )