This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit f0a174d8215d16018592ee369db3e88ddc44eed0
Author: juanpablo <[email protected]>
AuthorDate: Sun Mar 29 00:06:15 2020 +0100

    fix possible-but-improbable npe
---
 jspwiki-war/src/main/webapp/SisterSites.jsp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/jspwiki-war/src/main/webapp/SisterSites.jsp 
b/jspwiki-war/src/main/webapp/SisterSites.jsp
index 90481cc..f438dc9 100644
--- a/jspwiki-war/src/main/webapp/SisterSites.jsp
+++ b/jspwiki-war/src/main/webapp/SisterSites.jsp
@@ -51,11 +51,13 @@
         if( wiki.getManager( AttachmentManager.class ).getAttachmentInfoName( 
wikiContext, pageName ) != null ) continue;
 
         Page wikiPage = wiki.getManager( PageManager.class ).getPage( pageName 
);
-        PagePermission permission = PermissionFactory.getPagePermission( 
wikiPage, "view" );
-        boolean allowed = wiki.getManager( AuthorizationManager.class 
).checkPermission( wikiContext.getWikiSession(), permission );
-        if( allowed ) {
-            String url = wikiContext.getViewURL( pageName );
-            out.write( url + " " + pageName + "\n" );
+        if( wikiPage != null ) { // there's a possibility the wiki page may 
get deleted between the call to reference manager and now...
+            PagePermission permission = PermissionFactory.getPagePermission( 
wikiPage, "view" );
+            boolean allowed = wiki.getManager( AuthorizationManager.class 
).checkPermission( wikiContext.getWikiSession(), permission );
+            if( allowed ) {
+                String url = wikiContext.getViewURL( pageName );
+                out.write( url + " " + pageName + "\n" );
+            }
         }
     }
  %>
\ No newline at end of file

Reply via email to