Skip to content

Commit cf66323

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 b708b89 commit cf66323

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
@@ -214,11 +214,11 @@ void mapclass::updateroomnames(void)
214214
if (rx == roomname->x && ry == roomname->y && (roomname->flag == -1 || (INBOUNDS_ARR(roomname->flag, obj.flags) && obj.flags[roomname->flag])))
215215
{
216216
roomname_special = true;
217-
if (roomname->type == RoomnameType_STATIC)
217+
if (roomname->type == RoomnameType_STATIC && roomname->text.size() >= 1)
218218
{
219219
setroomname(roomname->text[0].c_str());
220220
}
221-
if (roomname->type == RoomnameType_GLITCH)
221+
if (roomname->type == RoomnameType_GLITCH && roomname->text.size() >= 2)
222222
{
223223
roomname->delay--;
224224
if (roomname->delay <= 0)
@@ -232,7 +232,7 @@ void mapclass::updateroomnames(void)
232232
}
233233
setroomname(roomname->text[roomname->progress].c_str());
234234
}
235-
if (roomname->type == RoomnameType_TRANSFORM)
235+
if (roomname->type == RoomnameType_TRANSFORM && roomname->text.size() >= 1)
236236
{
237237
roomname->delay--;
238238
if (roomname->delay <= 0)

0 commit comments

Comments
 (0)