Browse Source

updateKeyboard should use the SDL window's screen instead of the view window's screen, which may be nil.

Fixes https://github.com/libsdl-org/SDL/issues/8200
Sam Lantinga 1 year ago
parent
commit
3a9a52fe6c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/video/uikit/SDL_uikitviewcontroller.m

+ 3 - 1
src/video/uikit/SDL_uikitviewcontroller.m

@@ -511,12 +511,14 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
 
 - (void)updateKeyboard
 {
+    SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *) window->driverdata;
+
     CGAffineTransform t = self.view.transform;
     CGPoint offset = CGPointMake(0.0, 0.0);
 #if TARGET_OS_XR
     CGRect frame = UIKit_ComputeViewFrame(window);
 #else
-    CGRect frame = UIKit_ComputeViewFrame(window, self.view.window.screen);
+    CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen);
 #endif
 
     if (self.keyboardHeight) {