From 6f4993ddee9ca44648d0d648d4095c491973ec65 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 8 Oct 2025 20:14:51 -0700 Subject: [PATCH] Ignore invalid width/height in setOrientationBis() --- .../app/src/main/java/org/libsdl/app/SDLActivity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 422fe76424..a49cd940d0 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1120,6 +1120,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;