Fix NPE when site header or footer isn't present

If there is no site header or footer, HostPageServlet deletes
these from the document it sends to the browser, which means we
have no DOM handle to the node.  We can't set visiblity on null,
so skip the set call.

Bug: issue 587
Change-Id: I6e16472f35b99f18fea4eead9cd1029e87b4b1f2
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2010-06-17 09:40:53 -07:00
parent d5c3530d89
commit e8fd49f5f7
1 changed files with 6 additions and 2 deletions

View File

@ -479,8 +479,12 @@ public class Gerrit implements EntryPoint {
if (myAccount != null) {
final AccountGeneralPreferences p = myAccount.getGeneralPreferences();
CopyableLabel.setFlashEnabled(p.isUseFlashClipboard());
siteHeader.setVisible(p.isShowSiteHeader());
siteFooter.setVisible(p.isShowSiteHeader());
if (siteHeader != null) {
siteHeader.setVisible(p.isShowSiteHeader());
}
if (siteFooter != null) {
siteFooter.setVisible(p.isShowSiteHeader());
}
}
}