瀏覽代碼

Ignore invalid width/height in setOrientationBis()

Sam Lantinga 2 天之前
父節點
當前提交
6f4993ddee
共有 1 個文件被更改,包括 5 次插入0 次删除
  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

@@ -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;