Skip to content

Fix empty roomnames potentially crashing the game#1265

Merged
flibitijibibo merged 2 commits intoTerryCavanagh:masterfrom
NyakoFox:empty-roomname-fix
Feb 16, 2026
Merged

Fix empty roomnames potentially crashing the game#1265
flibitijibibo merged 2 commits intoTerryCavanagh:masterfrom
NyakoFox:empty-roomname-fix

Conversation

@NyakoFox
Copy link
Contributor

Changes:

TinyXML2 seems to sometimes return NULL when an element has either no text or whitespace, instead of returning an empty string. Why it does this, I'm not sure, but I have recently learned from @Daaaav that it will crash the game. Great.

Should probably be merged in a 2.4 branch too.

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
    section of the credits for all of said releases, but will NOT be compensated
    for these changes unless there is a prior written agreement

TinyXML2 seems to sometimes return NULL when an element has either no
text or whitespace, instead of returning an empty string. Why it does
this, I'm not sure, but I have recently learned from Dav999 that it
will crash the game. Great.
There's another crash, which is indexing out of bounds if there's
not enough text. This adds simple bounds checks for them.
@flibitijibibo flibitijibibo merged commit deeed00 into TerryCavanagh:master Feb 16, 2026
3 checks passed
@flibitijibibo
Copy link
Collaborator

2.4 backports:

b708b89

cf66323

Daaaav added a commit to Daaaav/Ved that referenced this pull request Feb 17, 2026
Ved now puts the special roomnames from the XML into data structures,
and writes those data structures back to XML.

As Ally fixed in TerryCavanagh/VVVVVV#1265,
it turned out the game couldn't deal with empty (or whitespace-only)
roomnames, since TinyXML's element GetText() method returns NULL if it
doesn't find a text node (or only stripped out whitespace). Luckily
this is easy for Ved to workaround by just using a <![CDATA[]]> instead
of raw text in that case, since that also counts as a text node (it's
basically just an escape). The bug just got fixed in the VVVVVV repo,
but it can't hurt to include the CDATA anyway (it's just two lines of
code and it parses the same)

[pre11]
@NyakoFox NyakoFox deleted the empty-roomname-fix branch February 19, 2026 19:30
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.

2 participants