stronghold: nullcheck

This commit is contained in:
Owain van Brakel
2020-01-12 20:49:29 +01:00
parent d950ff2028
commit 9b978c87cb

View File

@@ -42,7 +42,8 @@ import java.awt.Color;
name = "Stronghold", name = "Stronghold",
description = "Highlights the correct answer to Stronghold of Security questions", description = "Highlights the correct answer to Stronghold of Security questions",
tags = {"stronghold", "security", "overlay", "answer", "highlight"}, tags = {"stronghold", "security", "overlay", "answer", "highlight"},
type = PluginType.UTILITY type = PluginType.UTILITY,
enabledByDefault = false
) )
public class StrongholdPlugin extends Plugin public class StrongholdPlugin extends Plugin
{ {
@@ -87,6 +88,12 @@ public class StrongholdPlugin extends Plugin
private void onNPCDialogue() private void onNPCDialogue()
{ {
final Widget debugWidget = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); final Widget debugWidget = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT);
if (debugWidget == null)
{
return;
}
final String npcText = debugWidget.getText(); final String npcText = debugWidget.getText();
if (StrongholdAnswer.MATCHES.containsKey(npcText)) if (StrongholdAnswer.MATCHES.containsKey(npcText))
{ {