Android: Fix crashes on Android versions < 11 due to mCameraHelper being null

This commit is contained in:
Henrik Rydgård 2019-09-24 23:43:59 +02:00
parent 9d65ff8873
commit f3b84fd8a4

View File

@ -740,7 +740,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
Log.e(TAG, "mGLSurfaceView really shouldn't be null in onPause");
}
}
mCameraHelper.pause();
if (mCameraHelper != null) {
mCameraHelper.pause();
}
Log.i(TAG, "onPause completed");
}
@ -780,7 +782,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
mSurfaceView.onResume();
}
}
mCameraHelper.resume();
if (mCameraHelper != null) {
mCameraHelper.resume();
}
gainAudioFocus(this.audioManager, this.audioFocusChangeListener);
NativeApp.resume();
@ -1339,7 +1343,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
}
} else if (command.equals("event")) {
if (params.equals("exitgame")) {
mCameraHelper.stopCamera();
if (mCameraHelper != null) {
mCameraHelper.stopCamera();
}
}
}
return false;