GUI: Crash fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4095 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-29 08:48:16 +00:00
parent ff962750fb
commit 78bd8c874a

View File

@ -130,7 +130,8 @@ void ConsoleListener::LetterSpace(int Width, int Height)
void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool Resize)
{
#ifdef _WIN32
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// Check size
if (Width < 8 || Height < 12) return;
// Get console info
CONSOLE_SCREEN_BUFFER_INFO ConInfo;
@ -140,9 +141,11 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
int LHeight = floor((float)(Height / 12));
int LBufHeight = floor((float)(MAX_BYTES / (LWidth + 1)));
// Read the current text
char Str[MAX_BYTES];
// Check size
DWORD dwConSize = ConInfo.dwSize.X * ConInfo.dwSize.Y;
if (dwConSize > MAX_BYTES) return;
// Read the current text
char Str[MAX_BYTES];
DWORD cCharsRead = 0;
COORD coordScreen = { 0, 0 };
ReadConsoleOutputCharacter(hConsole, Str, dwConSize, coordScreen, &cCharsRead);