Skip to content
Snippets Groups Projects
Commit 12ae6d55 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix crash when erasing pop-ups with no startup mode set.

1) In savescreen(), if the vmode is not found, explicitly set
   pixels to NULL rather than leaving it uninitialized.
2) Ensure that currmode is never left as _ORIGMODE (which is not
   a defined mode, so can result in vmode not being found).
parent d39d2ca0
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4317 failed
......@@ -1765,6 +1765,8 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
if(!bitmap_initialized)
return(-1);
if (mode == _ORIGMODE)
mode = C80;
if(load_vmode(&vstat, mode)) {
return(-1);
}
......
......@@ -1770,6 +1770,9 @@ CIOLIBEXPORT struct ciolib_screen * ciolib_savescreen(void)
if (vmode != -1) {
ret->pixels = ciolib_getpixels(0, 0, vparams[vmode].xres - 1, vparams[vmode].yres - 1, FALSE);
}
else {
ret->pixels = NULL;
}
ciolib_vmem_gettext(1, 1, ret->text_info.screenwidth, ret->text_info.screenheight, ret->vmem);
ret->fg_colour = ciolib_fg;
ret->bg_colour = ciolib_bg;
......
......@@ -286,6 +286,8 @@ int find_vmode(int mode)
{
unsigned i;
if(mode==_ORIGMODE)
mode=C80;
for (i = 0; i < NUMMODES; i++)
if (vparams[i].mode == mode)
return i;
......
......@@ -632,10 +632,9 @@ void win32_textmode(int mode)
CONSOLE_SCREEN_BUFFER_INFOEX bi;
#endif
for(i=0;i<NUMMODES;i++) {
if(vparams[i].mode==mode)
modeidx=i;
}
modeidx = find_vmode(mode);
if (modeidx == -1)
modeidx = CO80;
sz.X = cio_textinfo.screenwidth > vparams[modeidx].cols ? cio_textinfo.screenwidth : vparams[modeidx].cols;
sz.Y = cio_textinfo.screenheight > vparams[modeidx].rows ? cio_textinfo.screenheight : vparams[modeidx].rows;
rc.Left=0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment