# SDL: wayland: Check for the input handle before checking the keyboard handle (b7e8e)

**URL:** <https://discourse.libsdl.org/t/sdl-wayland-check-for-the-input-handle-before-checking-the-keyboard-handle-b7e8e/39299>\
**Category:** SDL Commits\
**Created:** [October 11, 2022, 3:32pm UTC](https://discourse.libsdl.org/t/sdl-wayland-check-for-the-input-handle-before-checking-the-keyboard-handle-b7e8e/39299 "2022-10-11T15:32:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [October 11, 2022, 3:32pm UTC](https://discourse.libsdl.org/t/sdl-wayland-check-for-the-input-handle-before-checking-the-keyboard-handle-b7e8e/39299/1 "2022-10-11T15:32:03Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/b7e8e6f3b84ed99166957293d5944fe8cce46045>
>
> (cherry picked from commit be2cb0006644cb17cafca449f2d69c989e18ed2f)

```diff
From b7e8e6f3b84ed99166957293d5944fe8cce46045 Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Tue, 11 Oct 2022 11:16:52 -0400
Subject: [PATCH] wayland: Check for the input handle before checking the
 keyboard handle

(cherry picked from commit be2cb0006644cb17cafca449f2d69c989e18ed2f)
---
 src/video/wayland/SDL_waylandkeyboard.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c
index 8fcf678577ed..6f6115d220db 100644
--- a/src/video/wayland/SDL_waylandkeyboard.c
+++ b/src/video/wayland/SDL_waylandkeyboard.c
@@ -145,8 +145,9 @@ Wayland_HasScreenKeyboardSupport(_THIS)
      * input protocol, make sure we don't have any physical keyboards either.
      */
     SDL_VideoData *driverdata = _this->driverdata;
- return (driverdata->input->keyboard == NULL &&
- driverdata->text_input_manager != NULL);
+ SDL_bool haskeyboard = (driverdata->input != NULL) && (driverdata->input->keyboard != NULL);
+ SDL_bool hastextmanager = (driverdata->text_input_manager != NULL);
+ return (!haskeyboard && hastextmanager);
 }
 
 #endif /* SDL_VIDEO_DRIVER_WAYLAND */

```
