mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-16 04:13:50 +00:00
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:
parent
3698195375
commit
7f2f965b9c
@ -432,6 +432,8 @@ static INLINE void update_shifts(void)
|
|||||||
*/
|
*/
|
||||||
void _handle_key_press(int keycode, int scancode)
|
void _handle_key_press(int keycode, int scancode)
|
||||||
{
|
{
|
||||||
|
ASSERT(keyboard_driver);
|
||||||
|
|
||||||
if ((keyboard_driver->poll) || (!keyboard_polled)) {
|
if ((keyboard_driver->poll) || (!keyboard_polled)) {
|
||||||
/* process immediately */
|
/* process immediately */
|
||||||
if (scancode > 0) {
|
if (scancode > 0) {
|
||||||
|
@ -100,6 +100,9 @@ static const unsigned char hw_to_mycode[256] =
|
|||||||
*/
|
*/
|
||||||
void _al_win_kbd_update_shifts(void)
|
void _al_win_kbd_update_shifts(void)
|
||||||
{
|
{
|
||||||
|
if (!keyboard_driver)
|
||||||
|
return;
|
||||||
|
|
||||||
#define HANDLE_KEY(mycode, vk) \
|
#define HANDLE_KEY(mycode, vk) \
|
||||||
if (GetAsyncKeyState(vk) & 0x8000) { \
|
if (GetAsyncKeyState(vk) & 0x8000) { \
|
||||||
if (!key[mycode]) \
|
if (!key[mycode]) \
|
||||||
|
Loading…
Reference in New Issue
Block a user