Repository navigation
fix(Scurrius): read giant rat name once to avoid NPE in rat query (1.0.4) - #641
Merged
chsami merged 1 commit intoOct 15, 2026
Merged
Conversation
…0.4) The giant-rat query predicate called getName() twice; when the NPC despawned between the null check and toLowerCase() the second call returned null and the NPE aborted the Scurrius tick. 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 2212 (ScurriusPlugin 1.0.2, Microbot 2.6.33, 1 occurrence in the last 7 days) reports:
The exception ends the whole Scurrius tick.
Root cause
The giant-rat query filter was
n.getName() != null && n.getName().toLowerCase().contains("giant rat") && !n.getNpc().isDead(). It callsgetName()twice. If the rat despawns or its composition changes between the null check and the second call, the second call returns null andtoLowerCase()throws. The same line is still ondevelopment(1.0.3, line 193).Change
ScurriusScript: the query now uses.where(ScurriusScript::isLiveGiantRat). The new static helperisLiveGiantRat(Rs2NpcModel)reads the name once into a local, then checks for null, checks for "giant rat" (case-insensitive) and checks that the NPC is not dead.ScurriusPluginversion goes from 1.0.3 to 1.0.4.ScurriusScriptTest: 3 new Mockito tests:getName()returns "Giant rat" first and null second. The helper returns true andgetName()is called exactly once. This would throw with the old logic.Validation
./gradlew test --tests 'net.runelite.client.plugins.microbot.scurrius.*' --tests 'net.runelite.client.plugins.microbot.PluginManifestVersionTest' -PpluginList=ScurriusPlugingave BUILD SUCCESSFUL:Known gaps
getName()pattern in cache queries, for example DelvePrayerHelperScript:53 and :126, EnsouledHeadSlayerScript:140 and SalvagingScript:1460. They are out of scope for this per-error fix and are candidates for a follow-up sweep towithNameContainsor a single-read local.🤖 Generated with Claude Code
https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV