- Create a custom web item without a condition script (the rest of the configuration can be however you want so long as it's valid).
- Run the Script Registry
Expected result: The web item isn't shown in the list of scripts.
Actual result: The script registry fails with the following error:
Why it happens: ScriptRegistry.getScriptInfo(...) returns null instead of a ConfiguredItem object if the item in question doesn't have any script associated with it. ScriptRegistry.getFragmentsInfo() doesn't expect this and tries to access the scripts property of the returned value without doing a null check, causing the NPE.
How to solve: The simplest fix is probably to change getFragmentsInfo to use safe navigation on the scripts property: it's being used as a condition anyway so propagating the null doesn't matter. Doing it this way saves us from having to worry about breaking any contracts of getScriptInfo.