=== 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-20 19:39:28 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-06-21 05:55:38 +0000 @@ -98,11 +98,16 @@ { int id = organisationUnitStore.save( organisationUnit ); - if(organisationUnit.getParent() == null) + if ( organisationUnit.getParent() == 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" - currentUserService.getCurrentUser().getOrganisationUnits().add( organisationUnit ); + User currentUser = currentUserService.getCurrentUser(); + + if ( currentUser != null ) + { + currentUser.getOrganisationUnits().add( organisationUnit ); + } } log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_ADD, === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2012-05-22 18:57:53 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2012-06-21 05:55:38 +0000 @@ -288,7 +288,7 @@ { var roots = JSON.parse( localStorage[getTagId( "Roots" )] ); - if ( roots != selected ) + if ( $.inArray(selected, roots) == -1 ) { return; }