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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user