Skip to content

Commit

Permalink
fix: add null checks to quickCanCast
Browse files Browse the repository at this point in the history
  • Loading branch information
g-mason0 committed Dec 31, 2024
1 parent 38e7608 commit e2648b6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public static boolean quickCanCast(MagicAction magicSpell) {
Rs2Tab.switchToMagicTab();
sleepUntil(() -> Rs2Tab.getCurrentTab() == InterfaceTab.MAGIC);
}

Widget widget = Rs2Widget.findWidget(magicSpell.getName());

Widget spellbookWidget = Rs2Widget.getWidget(218, 3);
if (spellbookWidget == null) return false;
Widget widget = Rs2Widget.findWidget(magicSpell.getName(), List.of(spellbookWidget));
if (widget == null) return false;
return widget.getSpriteId() == magicSpell.getSprite();

}

public static boolean quickCanCast(String spellName) {
Expand Down

0 comments on commit e2648b6

Please sign in to comment.