Check to make sure the captured picture is non null before using.

Fixes http://b/issue?id=2154493

Change-Id: Id9898b2251585e8adbae286df6173a2e1989c838
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 15f986e..d0ebc8b 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -2420,6 +2420,10 @@
                     final ByteArrayOutputStream os
                             = new ByteArrayOutputStream();
                     Bitmap bm = createScreenshot(view);
+                    if (bm == null) {
+                        c.close();
+                        return;
+                    }
                     bm.compress(Bitmap.CompressFormat.PNG, 100, os);
                     values = new ContentValues();
                     values.put(Browser.BookmarkColumns.THUMBNAIL,
@@ -2470,6 +2474,9 @@
 
     private Bitmap createScreenshot(WebView view) {
         Picture thumbnail = view.capturePicture();
+        if (thumbnail == null) {
+            return null;
+        }
         Bitmap bm = Bitmap.createBitmap(getDesiredThumbnailWidth(this),
                 getDesiredThumbnailHeight(this), Bitmap.Config.ARGB_4444);
         Canvas canvas = new Canvas(bm);