It's quite weird. I get this crash when loading my baked lighting on laptop. It doesn't happen on desktop PC (why??) and doesn't happen on laptop with lighting baked by SomaZ (for t1_rail). The crash happens when it tries to load non-existing sky texture, but I didn't dig deeper. Anyway, solution is quite simple.
R_FindImageFile function in tr_image.cpp tries to load HDR image and then checks if it succeed by testing output buffer:
R_LoadHDRImage(filename, &pic, &width, &height);
if (pic == NULL)
...
The problem is, R_LoadHDRImage doesn't reset buffer to NULL if it failed.
So, in shared/rd-rend2/tr_image_stb.cpp need to add three lines:
// Loads a HDR image from file.
void R_LoadHDRImage( const char *filename, byte **data, int *width, int *height )
{
byte *buf = NULL;
int x, y, n;
int len = ri.FS_ReadFile (filename, (void **)&buf);
if ( len <= 0 || buf == NULL )
{
// reset output varialbes
*data = NULL;
*width = 0;
*height = 0;
return;
}
...
It's quite weird. I get this crash when loading my baked lighting on laptop. It doesn't happen on desktop PC (why??) and doesn't happen on laptop with lighting baked by SomaZ (for t1_rail). The crash happens when it tries to load non-existing sky texture, but I didn't dig deeper. Anyway, solution is quite simple.
R_FindImageFile function in tr_image.cpp tries to load HDR image and then checks if it succeed by testing output buffer:
The problem is, R_LoadHDRImage doesn't reset buffer to NULL if it failed. So, in shared/rd-rend2/tr_image_stb.cpp need to add three lines: