Verhinderung einer NPE

git-svn-id: https://svn.libreccm.org/ccm/trunk@657 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-12-25 16:11:51 +00:00
parent e01da4aefb
commit 90ac81b6b3
1 changed files with 5 additions and 2 deletions

View File

@ -83,9 +83,12 @@ public final class SubsiteContext {
* @return the currently selected content site
*/
public final Site getSite() {
Site site = null;
HttpServletRequest request = DispatcherHelper.getRequest();
Site site = (Site)request.getAttribute(SITE_REQUEST_ATTRIBUTE);
Assert.exists(site, Site.class);
if(request.getAttribute(SITE_REQUEST_ATTRIBUTE) != null) {
site = (Site)request.getAttribute(SITE_REQUEST_ATTRIBUTE);
Assert.exists(site, Site.class);
}
return site;
}
}