slayer: Fix NPE when getting unsupported task (#9490)
This commit is contained in:
committed by
Tomas Slusny
parent
529570d91a
commit
e5d9dd4ceb
@@ -535,7 +535,14 @@ public class SlayerPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final int taskKillExp = Task.getTask(taskName).getExpectedKillExp();
|
||||
final Task task = Task.getTask(taskName);
|
||||
|
||||
if (task == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final int taskKillExp = task.getExpectedKillExp();
|
||||
|
||||
// Only count exp gain as a kill if the task either has no expected exp for a kill, or if the exp gain is equal
|
||||
// to the expected exp gain for the task.
|
||||
@@ -595,7 +602,7 @@ public class SlayerPlugin extends Plugin
|
||||
private boolean doubleTroubleExtraKill()
|
||||
{
|
||||
return WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()).getRegionID() == GROTESQUE_GUARDIANS_REGION &&
|
||||
SlayerUnlock.GROTESQUE_GUARDIAN_DOUBLE_COUNT.isEnabled(client);
|
||||
SlayerUnlock.GROTESQUE_GUARDIAN_DOUBLE_COUNT.isEnabled(client);
|
||||
}
|
||||
|
||||
private boolean isTarget(NPC npc)
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.slayer;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
@@ -228,6 +229,7 @@ enum Task
|
||||
this.expectedKillExp = expectedKillExp;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static Task getTask(String taskName)
|
||||
{
|
||||
return tasks.get(taskName.toLowerCase());
|
||||
|
||||
Reference in New Issue
Block a user