Skip to content

Commit

Permalink
Fix NPE with OverlayTransformApiHelper
Browse files Browse the repository at this point in the history
OverlayTransformApiHelper is only created if the WindowAndroid has a
Window.

Add an extra check when the object is actually created before being
used.

Change-Id: I835b8101069c8ee3c03bec9e71c63b1e4b66c751
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3865018
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1042176}
  • Loading branch information
rayankans authored and Chromium LUCI CQ committed Sep 1, 2022
1 parent c338837 commit 8a5ee87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@ void onOverlayTransformUpdated() {
@CalledByNative
private @OverlayTransform int getOverlayTransform() {
int overlayTransform = OverlayTransform.INVALID;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2
&& mOverlayTransformApiHelper != null) {
overlayTransform = mOverlayTransformApiHelper.getOverlayTransform();
}
// Fallback to display rotation
Expand Down

0 comments on commit 8a5ee87

Please sign in to comment.