avoid NPE
authorfstamatelopoulos <devnull@localhost>
Mon, 23 Mar 2009 14:14:06 +0000 (14:14 +0000)
committerfstamatelopoulos <devnull@localhost>
Mon, 23 Mar 2009 14:14:06 +0000 (14:14 +0000)
gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java

index af3f963..67b62c4 100644 (file)
@@ -1508,14 +1508,14 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote {
                        else
                                throw new InsufficientPermissionsException("Only the owner can change the read-for-all flag");
 
-               if (!permissions.isEmpty()) {
+               if (permissions != null && !permissions.isEmpty()) {
                        file.getPermissions().clear();
                        for (PermissionDTO dto : permissions)
                                file.addPermission(getPermission(dto));
                }
 
                // Update the file if there was a change.
-               if (readForAll != null || !permissions.isEmpty())
+               if (readForAll != null || permissions != null && !permissions.isEmpty())
                        dao.update(file);
 
        }