Skip to content

fix(SulphurNaguaPlugin): guard null player location in fighting and runecrafting (2.0.4) - #660

Merged
chsami merged 1 commit into
developmentfrom
claude/err-sulphurnagua-combat-area-null-player-location
Oct 19, 2026
Merged

chsami merged 1 commit into
developmentfrom
claude/err-sulphurnagua-combat-area-null-player-location

Conversation

@chsami

@chsami chsami commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Problem

Client error telemetry group 2666 (1 occurrence, 1 report, Microbot 2.6.34, SulphurNaguaPlugin 2.0.3):

java.lang.NullPointerException: Cannot invoke "net.runelite.api.coords.WorldPoint.toWorldArea()" because "oth... (truncated by telemetry)
  at net.runelite.api.coords.WorldArea.distanceTo:132
  at net.runelite.api.coords.WorldArea.contains:165
  at ...sulphurnaguafigther.SulphurNaguaScript.handleFighting:538
  at ...sulphurnaguafigther.SulphurNaguaScript.lambda$run$0:175

Root cause

handleFighting null-checked combatArea but passed Rs2Player.getWorldLocation() straight into WorldArea.contains. While the local player is briefly unavailable (logout, hop, death, teleport) that location is null and contains throws. handleGettingRunecraftingXp had the same unguarded pattern with getWorldLocation().distanceTo(EYTALLALI_LOCATION).

Change

  • New package-private static boolean isInArea(WorldArea area, WorldPoint point) that returns false when either argument is null; isInCombatArea() now delegates to it with unchanged behaviour.
  • handleFighting: reads the player location once and skips the tick when it is null (avoids walking back to the fight centre while the player is not loaded); uses isInArea(combatArea, playerLoc).
  • handleGettingRunecraftingXp: same null guard before distanceTo.
  • SulphurNaguaPlugin version 2.0.3 -> 2.0.4.
  • New SulphurNaguaCombatAreaTest covering isInArea with null point, null area, inside and outside.

Validation

  • ./gradlew test -PpluginList=SulphurNaguaPlugin --tests 'net.runelite.client.plugins.microbot.sulphurnaguafigther.*' --tests 'net.runelite.client.plugins.microbot.PluginManifestVersionTest' -> BUILD SUCCESSFUL (SulphurNaguaCombatAreaTest 4/4, SulphurNaguaInteractingTest 7/7, PluginManifestVersionTest 1/1).
  • ./gradlew build -PpluginList=SulphurNaguaPlugin -x test -> BUILD SUCCESSFUL.

Known gaps

  • The test covers only the new helper; handleFighting / handleGettingRunecraftingXp depend on static client calls and are not unit-tested directly.
  • Other getWorldLocation() uses in the plugin were reviewed and left as-is: walkTo(null) returns false in Rs2Walker, and dropLocation is only logged and reset.
  • Not live-tested in game.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV

…fting (2.0.4)

handleFighting passed Rs2Player.getWorldLocation() straight into
WorldArea.contains, which throws an NPE when the local player is briefly
unavailable during logout, hop, death or loading. Skip the tick when the
location is null and route the combat-area check through a shared null-safe
isInArea helper. Apply the same guard to the Eytallali distance check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
@chsami
chsami merged commit 3d80829 into development Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant