Bug 692961 - Capturing image on camera api crashes [@ mozalloc_abort | __swrite ] [r=blassey]
authorFabrice Desré <fabrice@mozilla.com>
Mon, 10 Oct 2011 14:01:39 -0700
changeset 79004 6d2612f175306c4fa7d0c45f2619207e85568ef1
parent 79003 962683b9d15a5c83f352b2cfd414a9ba47253c2f
child 79005 818edd78ffacaf37040b618094f630b575daf05c
push idunknown
push userunknown
push dateunknown
reviewersblassey
bugs692961
milestone10.0a1
Bug 692961 - Capturing image on camera api crashes [@ mozalloc_abort | __swrite ] [r=blassey]
embedding/android/GeckoAppShell.java
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -1586,17 +1586,18 @@ public class GeckoAppShell
             }
 
             sCamera.setParameters(params);
             sCameraBuffer = new byte[(bufferSize * 12) / 8];
             sCamera.addCallbackBuffer(sCameraBuffer);
             sCamera.setPreviewCallbackWithBuffer(new android.hardware.Camera.PreviewCallback() {
                 public void onPreviewFrame(byte[] data, android.hardware.Camera camera) {
                     cameraCallbackBridge(data);
-                    sCamera.addCallbackBuffer(sCameraBuffer);
+                    if (sCamera != null)
+                        sCamera.addCallbackBuffer(sCameraBuffer);
                 }
             });
             sCamera.startPreview();
             params = sCamera.getParameters();
             Log.i("GeckoAppJava", "Camera: " + params.getPreviewSize().width + "x" + params.getPreviewSize().height +
                   " @ " + params.getPreviewFrameRate() + "fps. format is " + params.getPreviewFormat());
             result[0] = 1;
             result[1] = params.getPreviewSize().width;