Browse Source

Ignore invalid width/height in setOrientationBis()

(cherry picked from commit 6f4993ddee9ca44648d0d648d4095c491973ec65)
Sam Lantinga 4 months ago
parent
commit
205b5c9f44
1 changed files with 5 additions and 0 deletions
  1. 5 0
      android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

+ 5 - 0
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

@@ -1128,6 +1128,11 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
         int orientation_landscape = -1;
         int orientation_portrait = -1;
 
+        if (w <= 1 || h <= 1) {
+            // Invalid width/height, ignore this request
+            return;
+        }
+
         /* If set, hint "explicitly controls which UI orientations are allowed". */
         if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
             orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;