OPS thumbnail crash fix, and blank thumbnails for saves from a newer version
This commit is contained in:
parent
4af8385a0e
commit
f0730818e4
@ -6276,13 +6276,13 @@ void catalogue_ui(pixel * vid_buf)
|
|||||||
csave->image = resample_img(tmpimage, imgwidth, imgheight, XRES/CATALOGUE_S, YRES/CATALOGUE_S);
|
csave->image = resample_img(tmpimage, imgwidth, imgheight, XRES/CATALOGUE_S, YRES/CATALOGUE_S);
|
||||||
free(tmpimage);
|
free(tmpimage);
|
||||||
} else {
|
} else {
|
||||||
//Blank image, this should default to something else
|
//Blank image, TODO: this should default to something else
|
||||||
csave->image = malloc((XRES/CATALOGUE_S)*(YRES/CATALOGUE_S)*PIXELSIZE);
|
csave->image = calloc((XRES/CATALOGUE_S)*(YRES/CATALOGUE_S), PIXELSIZE);
|
||||||
}
|
}
|
||||||
free(data);
|
free(data);
|
||||||
} else {
|
} else {
|
||||||
//Blank image, this should default to something else
|
//Blank image, TODO: this should default to something else
|
||||||
csave->image = malloc((XRES/CATALOGUE_S)*(YRES/CATALOGUE_S)*PIXELSIZE);
|
csave->image = calloc((XRES/CATALOGUE_S)*(YRES/CATALOGUE_S), PIXELSIZE);
|
||||||
}
|
}
|
||||||
imageoncycle = 1;
|
imageoncycle = 1;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ pixel *prerender_save_OPS(void *save, int size, int *width, int *height)
|
|||||||
int inputDataLen = size, bsonDataLen = 0, partsDataLen, partsPosDataLen, wallDataLen;
|
int inputDataLen = size, bsonDataLen = 0, partsDataLen, partsPosDataLen, wallDataLen;
|
||||||
int i, x, y, j;
|
int i, x, y, j;
|
||||||
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
|
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
|
||||||
|
int bsonInitialised = 0;
|
||||||
pixel * vidBuf = NULL;
|
pixel * vidBuf = NULL;
|
||||||
bson b;
|
bson b;
|
||||||
bson_iterator iter;
|
bson_iterator iter;
|
||||||
@ -121,6 +122,7 @@ pixel *prerender_save_OPS(void *save, int size, int *width, int *height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bson_init_data(&b, bsonData);
|
bson_init_data(&b, bsonData);
|
||||||
|
bsonInitialised = 1;
|
||||||
bson_iterator_init(&iter, &b);
|
bson_iterator_init(&iter, &b);
|
||||||
while(bson_iterator_next(&iter))
|
while(bson_iterator_next(&iter))
|
||||||
{
|
{
|
||||||
@ -301,6 +303,8 @@ fail:
|
|||||||
vidBuf = NULL;
|
vidBuf = NULL;
|
||||||
}
|
}
|
||||||
fin:
|
fin:
|
||||||
|
//Don't call bson_destroy if bson_init wasn't called, or an uninitialised pointer (b.data) will be freed and the game will crash
|
||||||
|
if (bsonInitialised)
|
||||||
bson_destroy(&b);
|
bson_destroy(&b);
|
||||||
return vidBuf;
|
return vidBuf;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user