Skip to content

fix(rbxml): return None from get_track when track is not found#200

Open
SAY-5 wants to merge 1 commit into
dylanljones:masterfrom
SAY-5:fix/get-track-missing
Open

fix(rbxml): return None from get_track when track is not found#200
SAY-5 wants to merge 1 commit into
dylanljones:masterfrom
SAY-5:fix/get-track-missing

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

Closes #193.

When the requested TrackID, Location, or index doesn't match any element, get_track previously called Track(element=None). The None then propagated into ElementTree.SubElement, where it surfaced as the misleading TypeError: SubElement() argument 1 must be xml.etree.ElementTree.Element, not None.

This change returns None from get_track when the lookup misses, matching the suggestion in the issue, and adds a regression test that exercises both TrackID and Location lookups for non-existent tracks.

When the requested TrackID, Location, or index does not match any
element, Track(element=None) propagates a None into ElementTree's
SubElement, which raised an unclear TypeError later. Return None
instead so callers can detect a missing track.

Closes dylanljones#193
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.

get_track should check that the track exists

1 participant