NPE in getting extension which has lowest order property

There’s a line in the appui code that’s causing NPEs that are hard to debug.

I would fix it, but I don’t understand the code. A few people have commented on that line and no one whose yet seen that code seems to understand it well enough to make the fix. @suthagar23, you wrote that code—can we expect you to fix it? All I’m hoping for is something like

Extension lowestOrderExtension = getLowestOrderExtenstion(exts);
if (lowestOrderExtension == null) {
  throw new Exception("Something explaining what's gone wrong, some reasons why this might happen, and suggestions for how someone might fix it.");
Map<String, Object> configSettings = lowestOrderExtension.getExtensionParams();

In order to maintain the logic of the original code, which expected null in some cases, i would not throw an exception when lowestOrderExtension is null. So i have fixed it as in this commit.

1 Like

Awesome, that makes perfect sense. Thank you!