Fix NullPointerException when connected but no video frame decoded

This fixes a crash seen when connecting to a host from the Android
Chromoting client. The painting code got called before a video frame had
been decoded, and tried to dereference a null Bitmap.

NOTRY=true

Review URL: https://codereview.chromium.org/47873012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233025 0039d316-1c4b-4281-b951-d872f2087c98
parent d9cbd050
...@@ -85,6 +85,11 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface, Ru ...@@ -85,6 +85,11 @@ public class DesktopView extends SurfaceView implements DesktopViewInterface, Ru
} }
Bitmap image = JniInterface.getVideoFrame(); Bitmap image = JniInterface.getVideoFrame();
if (image == null) {
// This can happen if the client is connected, but a complete video frame has not yet
// been decoded.
return;
}
int width = image.getWidth(); int width = image.getWidth();
int height = image.getHeight(); int height = image.getHeight();
......
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