=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-06-21 05:55:38 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-06-21 10:34:24 +0000 @@ -98,16 +98,11 @@ { int id = organisationUnitStore.save( organisationUnit ); - if ( organisationUnit.getParent() == null ) + if ( organisationUnit.getParent() == null && currentUserService.getCurrentUser() != null ) { // we are adding a new root node, add this node to the current user // this makes sense in most cases, and makes sure that we don't have "zombie nodes" - User currentUser = currentUserService.getCurrentUser(); - - if ( currentUser != null ) - { - currentUser.getOrganisationUnits().add( organisationUnit ); - } + currentUserService.getCurrentUser().getOrganisationUnits().add( organisationUnit ); } log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_ADD,