Add null-check to PlayerView
to avoid NPE in edit mode
Previously we assumed that `surfaceSyncGroupV34` was always non-null on API 34, but this isn't true in edit mode. Instead we add an explicit null-check before accessing it. We don't need to null-check it at the other usage site because we are already null-checking `surfaceView` (via `instanceof` check). Issue: androidx/media#1237 #cherrypick PiperOrigin-RevId: 645008049
This commit is contained in:
parent
307655f6d5
commit
99803066ea
@ -1783,8 +1783,8 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
|||||||
@Override
|
@Override
|
||||||
protected void dispatchDraw(Canvas canvas) {
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
super.dispatchDraw(canvas);
|
super.dispatchDraw(canvas);
|
||||||
if (Util.SDK_INT == 34) {
|
if (Util.SDK_INT == 34 && surfaceSyncGroupV34 != null) {
|
||||||
checkNotNull(surfaceSyncGroupV34).maybeMarkSyncReadyAndClear();
|
surfaceSyncGroupV34.maybeMarkSyncReadyAndClear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user