Check if keyboard_driver is installed before using it in _al_win_kbd_update_shifts().

The function _handle_key_press() cannot be used if keyboard_driver is
NULL and this can happen in the creation process of the window if the user
is pressing keys.
This commit is contained in:
David Capello 2012-08-22 22:34:03 -03:00
parent 3698195375
commit 7f2f965b9c
2 changed files with 5 additions and 0 deletions

View File

@ -432,6 +432,8 @@ static INLINE void update_shifts(void)
*/
void _handle_key_press(int keycode, int scancode)
{
ASSERT(keyboard_driver);
if ((keyboard_driver->poll) || (!keyboard_polled)) {
/* process immediately */
if (scancode > 0) {

View File

@ -100,6 +100,9 @@ static const unsigned char hw_to_mycode[256] =
*/
void _al_win_kbd_update_shifts(void)
{
if (!keyboard_driver)
return;
#define HANDLE_KEY(mycode, vk) \
if (GetAsyncKeyState(vk) & 0x8000) { \
if (!key[mycode]) \