From: Aleksandar Andrejevic Date: Fri, 4 Oct 2013 21:16:58 +0000 (+0000) Subject: [NTVDM] X-Git-Tag: backups/0.3.17@66124~1365^2~401 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=0043c2f37785f45d909d5e64cc9a02fa1b6342ef;hp=3593b8c8ef75234c66c97eaed60a9684556a5d76 [NTVDM] Properly handle the case when the console framebuffer could not be created. svn path=/branches/ntvdm/; revision=60526 --- diff --git a/subsystems/ntvdm/vga.c b/subsystems/ntvdm/vga.c index ab2772f4cf9..d4616a789b2 100644 --- a/subsystems/ntvdm/vga.c +++ b/subsystems/ntvdm/vga.c @@ -488,12 +488,22 @@ static VOID VgaChangeMode(VOID) if (!(VgaGcRegisters[VGA_GC_MISC_REG] & VGA_GC_MISC_NOALPHA)) { /* Enter new text mode */ - if (!VgaEnterTextMode(&Resolution)) return; + if (!VgaEnterTextMode(&Resolution)) + { + DisplayMessage(L"An unexpected VGA error occurred while switching into text mode."); + VdmRunning = FALSE; + return; + } } else { /* Enter 8-bit graphics mode */ - if (!VgaEnterGraphicsMode(&Resolution)) return; + if (!VgaEnterGraphicsMode(&Resolution)) + { + DisplayMessage(L"An unexpected VGA error occurred while switching into graphics mode."); + VdmRunning = FALSE; + return; + } } /* Trigger a full update of the screen */ @@ -516,6 +526,12 @@ static VOID VgaUpdateFramebuffer(VOID) + VgaCrtcRegisters[VGA_CRTC_START_ADDR_LOW_REG]; DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] * 2; + /* + * If console framebuffer is NULL, that means something went wrong + * earlier and this is the final display refresh. + */ + if (ConsoleFramebuffer == NULL) return; + /* Check if this is text mode or graphics mode */ if (VgaGcRegisters[VGA_GC_MISC_REG] & VGA_GC_MISC_NOALPHA) {