Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
17.10.9, 18.4.2
-
None
-
Unknown
-
Description
Steps to reproduce:
- Go to "Wiki Administration > Look & Feel > Themes" and select "---" for the Icon Theme. I suppose this means "Use the default value", i.e. don't set any explicit value, use whatever is the default. Save and reload the page. Notice that the XWiki UI is now using the Silk icon theme. It doesn't matter if it's Silk or something else. What's important is that icons are still displayed, from a default icon theme, whatever that may be.
- Go to "Wiki Administration > Content > Page Template" and start creating a new page template
- Try to set the template icon. Notice that the icon picker fails to load the icons.
The REST API return:
{"iconThemes":["Font Awesome","Silk"],"currentIconTheme":null}
And thus the icon picker tries to load the icon from
/xwiki/bin/get/IconThemesCode/IconPicker?outputSyntax=plain&action=data_icons&iconTheme=null
which throws:
Failed to execute the [velocity] macro. Cause: [Cannot invoke "org.xwiki.icon.IconSet.getIconNames()" because the return value of "org.xwiki.icon.IconSetManager.getIconSet(String)" is null
This breaks the JavaScript code:
Uncaught TypeError: can't access property "length", icons[currentIconTheme] is undefined
Having no explicit icon theme selected is not common, but it happens in functional tests. Nevertheless, we should bulletproof the icon picker code to work even when there is not icon theme selected explicitly.