Android: Add null check for InputOverlay

Hopefully fixes https://bugs.dolphin-emu.org/issues/12316.
This commit is contained in:
JosJuice 2020-11-11 10:38:49 +01:00
parent 72997c17d0
commit 32ad2dcec3
1 changed files with 10 additions and 7 deletions

View File

@ -94,14 +94,17 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
doneButton.setOnClickListener(v -> stopConfiguringControls());
}
contents.post(() ->
if (mInputOverlay != null)
{
int overlayX = mInputOverlay.getLeft();
int overlayY = mInputOverlay.getTop();
mInputOverlay.setSurfacePosition(new Rect(
surfaceView.getLeft() - overlayX, surfaceView.getTop() - overlayY,
surfaceView.getRight() - overlayX, surfaceView.getBottom() - overlayY));
});
contents.post(() ->
{
int overlayX = mInputOverlay.getLeft();
int overlayY = mInputOverlay.getTop();
mInputOverlay.setSurfacePosition(new Rect(
surfaceView.getLeft() - overlayX, surfaceView.getTop() - overlayY,
surfaceView.getRight() - overlayX, surfaceView.getBottom() - overlayY));
});
}
// The new Surface created here will get passed to the native code via onSurfaceChanged.