Commit d303dd3d authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Prevent NPE in TextureView.getBitmap()" into jb-dev

parents 9ac32040 78245f77
......@@ -561,7 +561,17 @@ public class TextureView extends View {
applyUpdate();
applyTransformMatrix();
mLayer.copyInto(bitmap);
// This case can happen if the app invokes setSurfaceTexture() before
// we are able to create the hardware layer. We can safely initialize
// the layer here thanks to the validate() call at the beginning of
// this method
if (mLayer == null && mUpdateSurface) {
getHardwareLayer();
}
if (mLayer != null) {
mLayer.copyInto(bitmap);
}
}
return bitmap;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment