Skip to content

Commit deeed00

Browse files
NyakoFoxflibitijibibo
authored andcommitted
Make sure special roomnames have enough text
There's another crash, which is indexing out of bounds if there's not enough text. This adds simple bounds checks for them.
1 parent 11b660a commit deeed00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

desktop_version/src/Map.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ void mapclass::updateroomnames(void)
222222
if (rx == roomname->x && ry == roomname->y && (roomname->flag == -1 || (INBOUNDS_ARR(roomname->flag, obj.flags) && obj.flags[roomname->flag])))
223223
{
224224
roomname_special = true;
225-
if (roomname->type == RoomnameType_STATIC)
225+
if (roomname->type == RoomnameType_STATIC && roomname->text.size() >= 1)
226226
{
227227
setroomname(roomname->text[0].c_str());
228228
}
229-
if (roomname->type == RoomnameType_GLITCH)
229+
if (roomname->type == RoomnameType_GLITCH && roomname->text.size() >= 2)
230230
{
231231
roomname->delay--;
232232
if (roomname->delay <= 0)
@@ -240,7 +240,7 @@ void mapclass::updateroomnames(void)
240240
}
241241
setroomname(roomname->text[roomname->progress].c_str());
242242
}
243-
if (roomname->type == RoomnameType_TRANSFORM)
243+
if (roomname->type == RoomnameType_TRANSFORM && roomname->text.size() >= 1)
244244
{
245245
roomname->delay--;
246246
if (roomname->delay <= 0)

0 commit comments

Comments
 (0)