Fix NPEs from BoostsPlugin at startup

shownSkills wasn't being initialized until it received ConfigChanged
event, causing a NullPointerException when the overlay tried to iterate
over shownSkills
This commit is contained in:
SomeoneWithAnInternetConnection
2018-02-02 05:21:23 -05:00
parent 924fc9c8ae
commit b3356ea5a2

View File

@@ -84,6 +84,15 @@ public class BoostsPlugin extends Plugin
return boostsOverlay;
}
@Override
protected void startUp()
{
if (config.enabled())
{
updateShownSkills(config.enableSkill());
}
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
@@ -92,14 +101,7 @@ public class BoostsPlugin extends Plugin
return;
}
if (config.enableSkill())
{
shownSkills = ObjectArrays.concat(COMBAT, SKILLING, Skill.class);
}
else
{
shownSkills = COMBAT;
}
updateShownSkills(config.enableSkill());
if (event.getKey().equals("displayIndicators"))
{
@@ -121,4 +123,16 @@ public class BoostsPlugin extends Plugin
}
}
}
private void updateShownSkills(boolean showSkillingSkills)
{
if (showSkillingSkills)
{
shownSkills = ObjectArrays.concat(COMBAT, SKILLING, Skill.class);
}
else
{
shownSkills = COMBAT;
}
}
}