summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriele M <moto.falcon.git@gmail.com>2017-02-08 19:41:54 +0100
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-11 01:46:46 +0000
commit808f55927d942e390a1dad7fd627ab4fa4b96c78 (patch)
treede4ffb79fc8f960927590053408790f9d77a9b4a
parent670944b143ec4059ca3c02cccae6437205020bb3 (diff)
downloadandroid_packages_apps_Snap-808f55927d942e390a1dad7fd627ab4fa4b96c78.zip
android_packages_apps_Snap-808f55927d942e390a1dad7fd627ab4fa4b96c78.tar.gz
android_packages_apps_Snap-808f55927d942e390a1dad7fd627ab4fa4b96c78.tar.bz2
Snap: VideoModule: Restore check on mPreferenceRead
This fixes the following crash when switching from picture mode to video mode for the first time: FATAL EXCEPTION: main Process: org.cyanogenmod.snap, PID: 4243 java.lang.NullPointerException: Attempt to read from field 'int android.media.CamcorderProfile.videoFrameWidth' on a null object reference at com.android.camera.VideoModule.updateCameraParametersInitialize(VideoModule.java:2778) at com.android.camera.VideoModule.setCameraParameters(VideoModule.java:2822) at com.android.camera.VideoModule.startPreview(VideoModule.java:1353) at com.android.camera.VideoModule.onPreviewUIReady(VideoModule.java:3260) at com.android.camera.VideoUI.surfaceCreated(VideoUI.java:956) at android.view.SurfaceView.updateWindow(SurfaceView.java:618) at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:161) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2205) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6343) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:621) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6126) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Change-Id: I8f449aaa943636a9b3ce590425e8611def8df590 (cherry picked from commit 342b6177119011ecfa2a7f97fceb4027186944e1)
-rw-r--r--src/com/android/camera/VideoModule.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 776ea92..dad13b7 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -1317,7 +1317,7 @@ public class VideoModule extends BaseModule<VideoUI> implements
private void startPreview() {
Log.e(TAG, String.format("startPreview paused=%b device=%b params=%b", mPaused, mCameraDevice == null, mParameters == null), new Throwable());
- if (mPaused || mCameraDevice == null || mParameters == null) {
+ if (!mPreferenceRead || mPaused || mCameraDevice == null || mParameters == null) {
return;
}