Repository navigation
fix(SulphurNaguaPlugin): guard null player location in fighting and runecrafting (2.0.4) - #660
Merged
chsami merged 1 commit intoOct 19, 2026
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Client error telemetry group 2666 (1 occurrence, 1 report, Microbot 2.6.34, SulphurNaguaPlugin 2.0.3):
Root cause
handleFightingnull-checkedcombatAreabut passedRs2Player.getWorldLocation()straight intoWorldArea.contains. While the local player is briefly unavailable (logout, hop, death, teleport) that location is null andcontainsthrows.handleGettingRunecraftingXphad the same unguarded pattern withgetWorldLocation().distanceTo(EYTALLALI_LOCATION).Change
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); usesisInArea(combatArea, playerLoc).handleGettingRunecraftingXp: same null guard beforedistanceTo.SulphurNaguaCombatAreaTestcoveringisInAreawith 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
handleFighting/handleGettingRunecraftingXpdepend on static client calls and are not unit-tested directly.getWorldLocation()uses in the plugin were reviewed and left as-is:walkTo(null)returns false inRs2Walker, anddropLocationis only logged and reset.🤖 Generated with Claude Code
https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV