1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

fixed a crash with too large band

This commit is contained in:
Zeno Rogue 2024-02-22 18:41:52 +01:00
parent e33f26d51f
commit 8af2a43f5e

View File

@ -457,6 +457,11 @@ EX namespace history {
dynamicval<bool> di(inHighQual, true); dynamicval<bool> di(inHighQual, true);
renderbuffer glbuf(bandfull, bandfull, vid.usingGL); renderbuffer glbuf(bandfull, bandfull, vid.usingGL);
glbuf.make_surface(); if(!glbuf.srf) {
addMessage(XLAT("Could not create an image of that size."));
return;
}
vid.xres = vid.yres = bandfull; vid.xres = vid.yres = bandfull;
glbuf.enable(); current_display->radius = bandhalf; glbuf.enable(); current_display->radius = bandhalf;
calcparam(); calcparam();
@ -480,7 +485,8 @@ EX namespace history {
}; };
if(!band) { if(!band) {
addMessage("Could not create an image of that size."); addMessage(XLAT("Could not create an image of that size."));
return;
} }
else { else {
@ -528,6 +534,10 @@ EX namespace history {
len -= bandsegment; xpos -= bandsegment; len -= bandsegment; xpos -= bandsegment;
seglen = min(int(len), bandsegment); seglen = min(int(len), bandsegment);
band = SDL_CreateRGBSurface(SDL_SWSURFACE, seglen, bandfull,32,0,0,0,0); band = SDL_CreateRGBSurface(SDL_SWSURFACE, seglen, bandfull,32,0,0,0,0);
if(!band) {
addMessage(XLAT("Could not create an image of that size."));
return;
}
goto drawsegment; goto drawsegment;
} }
xpos += bwidth; xpos += bwidth;