Skip to content

fix: handle and exclude dotless sound keys (intentionally_empty)#909

Merged
mworzala merged 3 commits into
mainfrom
fix/play-sound-dotless-key
Jun 14, 2026
Merged

fix: handle and exclude dotless sound keys (intentionally_empty)#909
mworzala merged 3 commits into
mainfrom
fix/play-sound-dotless-key

Conversation

@mworzala

Copy link
Copy Markdown
Contributor

Problem

Selecting/rendering the minecraft:intentionally_empty sound in the action editor crashed a scheduled task with:

java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 19
  at net.hollowcube.mapmaker.runtime.parkour.action.gui.editors.PlaySoundEditor.makeSoundButton (line 85)

makeSoundButton parses a sound's minimal key as category.path… to pick an icon, assuming every key contains a .:

var key = id.substring(0, id.indexOf('.'));

intentionally_empty (asMinimalString()intentionally_empty, 19 chars, no dot) is a placeholder "no sound" event that has no category prefix, so indexOf('.') returns -1 and substring(0, -1) throws. It surfaced inside the debounced anvil-search update, hence "Exception in scheduled task."

Fix

  • PlaySoundEditor.makeSoundButton — guard the dotless case: the whole id is used as the key and falls through to the default icon. Also computes each indexOf once instead of recomputing the second dot. Defends against any other dotless sound key.
  • Autocompletors — exclude SoundEvent.INTENTIONALLY_EMPTY when building the sound search index, so the no-op placeholder sound never appears as a pickable option in the first place.

Both modules compile clean.

PostHog issue

https://us.posthog.com/project/72878/error_tracking/019cf337-116b-7323-a8b6-6baeba2d2630

mworzala added 3 commits June 13, 2026 07:39
SoundEvents whose minimal key contains no '.' (e.g. intentionally_empty)
caused makeSoundButton to call id.substring(0, id.indexOf('.')) with an
index of -1, throwing StringIndexOutOfBoundsException. Guard the dotless
case so the whole id is used as the key and falls through to the default
icon.
intentionally_empty is a placeholder no-op sound, not something a user
would want to pick. Skip it when building the sound search index so it
never appears in results.
@mworzala mworzala merged commit 52f1428 into main Jun 14, 2026
1 of 2 checks passed
@mworzala mworzala deleted the fix/play-sound-dotless-key branch June 14, 2026 13:27
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