[pal-cvs 2842] [587] check npe

svnno****@sourc***** svnno****@sourc*****
2007年 9月 26日 (水) 22:05:23 JST


Revision: 587
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=587
Author:   shinsuke
Date:     2007-09-26 22:05:22 +0900 (Wed, 26 Sep 2007)

Log Message:
-----------
check npe

Modified Paths:
--------------
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java


-------------- next part --------------
Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java	2007-09-26 13:04:58 UTC (rev 586)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java	2007-09-26 13:05:22 UTC (rev 587)
@@ -227,24 +227,36 @@
     }
 
     public boolean isFolder() {
-        NodeInfo entity = getNodeItems().get(getNodeIndex());
-        return entity.getType() == NodeInfo.FOLDER;
+        if (getNodeItems() != null && getNodeIndex() < getNodeItems().size()) {
+            NodeInfo entity = getNodeItems().get(getNodeIndex());
+            return entity.getType() == NodeInfo.FOLDER;
+        }
+        return false;
     }
 
     public boolean isPage() {
-        NodeInfo entity = getNodeItems().get(getNodeIndex());
-        return entity.getType() == NodeInfo.PAGE;
+        if (getNodeItems() != null && getNodeIndex() < getNodeItems().size()) {
+            NodeInfo entity = getNodeItems().get(getNodeIndex());
+            return entity.getType() == NodeInfo.PAGE;
+        }
+        return false;
     }
 
     public boolean isPageLayout() {
-        // cannot use isLayout
-        NodeInfo entity = getNodeItems().get(getNodeIndex());
-        return entity.getType() == NodeInfo.LAYOUT;
+        if (getNodeItems() != null && getNodeIndex() < getNodeItems().size()) {
+            // cannot use isLayout
+            NodeInfo entity = getNodeItems().get(getNodeIndex());
+            return entity.getType() == NodeInfo.LAYOUT;
+        }
+        return false;
     }
 
     public boolean isPortlet() {
-        NodeInfo entity = getNodeItems().get(getNodeIndex());
-        return entity.getType() == NodeInfo.PORTLET;
+        if (getNodeItems() != null && getNodeIndex() < getNodeItems().size()) {
+            NodeInfo entity = getNodeItems().get(getNodeIndex());
+            return entity.getType() == NodeInfo.PORTLET;
+        }
+        return false;
     }
 
     public String getReturnPathLinkHref() {


pal-cvs メーリングリストの案内