Skip to content
Snippets Groups Projects
Commit dcc15641 authored by Simon Urli's avatar Simon Urli
Browse files

XWIKI-19154: Cannot display icons on reset password template

  * Avoid a NPE when the context doc is null
  * Document that XWikiContext#getDoc can be null

(cherry picked from commit 3cdb378e)
parent 352ebe60
No related branches found
No related tags found
No related merge requests found
......@@ -512,6 +512,9 @@ public boolean isMainWiki(String wikiName)
return StringUtils.equalsIgnoreCase(wikiName, getMainXWiki());
}
/**
* @return the current document handled in the context or {@code null}.
*/
public XWikiDocument getDoc()
{
return (XWikiDocument) get("doc");
......
......@@ -236,14 +236,16 @@ public Set<DocumentReference> getAlwaysUsedExtensions()
public boolean hasPageExtensions(XWikiContext context)
{
XWikiDocument doc = context.getDoc();
List<BaseObject> objects = doc.getObjects(getExtensionClassName());
if (objects != null) {
for (BaseObject obj : objects) {
if (obj == null) {
continue;
}
if (obj.getStringValue(USE_FIELDNAME).equals("currentPage")) {
return true;
if (doc != null) {
List<BaseObject> objects = doc.getObjects(getExtensionClassName());
if (objects != null) {
for (BaseObject obj : objects) {
if (obj == null) {
continue;
}
if (obj.getStringValue(USE_FIELDNAME).equals("currentPage")) {
return true;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment