port: don't crash when swapping empty rooms

This commit is contained in:
fgsfds 2023-08-20 22:20:12 +02:00
parent b4207b3fd9
commit b9944e8669
1 changed files with 7 additions and 4 deletions

View File

@ -1452,10 +1452,13 @@ void preprocessBgRoom(u8 *data, u32 ofs) {
// numvertices is actually 0 in the data because fuck you
const s32 numverts = ((uintptr_t) rgfx->colours - (uintptr_t) rgfx->vertices) / sizeof(Vtx);
Vtx *vertices = PD_PTR_BASEOFS(rgfx->vertices, data, ofs);
Vtx *vtx = vertices;
for (s32 i = 0; i < numverts; ++i, ++vtx) {
preprocessVtx(vtx);
Vtx *vertices = NULL;
if (rgfx->vertices) {
vertices = PD_PTR_BASEOFS(rgfx->vertices, data, ofs);
Vtx *vtx = vertices;
for (s32 i = 0; i < numverts; ++i, ++vtx) {
preprocessVtx(vtx);
}
}
// here's hoping that xlublocks and opablocks aren't completely separate trees