diff --git a/dom/camera/GonkNativeWindow.cpp b/dom/camera/GonkNativeWindow.cpp index e6b412946df9..785714645389 100644 --- a/dom/camera/GonkNativeWindow.cpp +++ b/dom/camera/GonkNativeWindow.cpp @@ -263,11 +263,15 @@ int GonkNativeWindow::dequeueBuffer(android_native_buffer_t** buffer) mPixelFormat, mUsage, &buffer); - sp graphicBuffer = - GrallocBufferActor::GetFrom(buffer.get_SurfaceDescriptorGralloc()); - if (!graphicBuffer.get()) { + // We can only use a gralloc buffer here. If we didn't get + // one back, something went wrong. + if (SurfaceDescriptor::TSurfaceDescriptorGralloc != buffer.type()) { + MOZ_ASSERT(SurfaceDescriptor::T__None == buffer.type()); + CNW_LOGE("dequeueBuffer: failed to alloc gralloc buffer"); return -ENOMEM; } + sp graphicBuffer = + GrallocBufferActor::GetFrom(buffer.get_SurfaceDescriptorGralloc()); error = graphicBuffer->initCheck(); if (error != NO_ERROR) { CNW_LOGE("dequeueBuffer: createGraphicBuffer failed with error %d",error);