Bug 1300484 - IconResponse: Throw if bitmap is null. r?ahunt draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Mon, 05 Sep 2016 11:46:27 +0200
changeset 409855 0b26b20b6ab941522d06b57302474ee2f9546819
parent 409854 b96e305b36b7836fc3563062565c99dc9639f65c
child 530441 cb0c69e1829b3b82ed05466446d3dba09e579711
push id28578
push users.kaspari@gmail.com
push dateMon, 05 Sep 2016 09:48:44 +0000
reviewersahunt
bugs1300484
milestone51.0a1
Bug 1300484 - IconResponse: Throw if bitmap is null. r?ahunt This will crash later anyways but throwing here will allow us to identify code that creates a response with a null bitmap (This shouldn't happen). MozReview-Commit-ID: LJMSsW51eXo
mobile/android/base/java/org/mozilla/gecko/icons/IconResponse.java
--- a/mobile/android/base/java/org/mozilla/gecko/icons/IconResponse.java
+++ b/mobile/android/base/java/org/mozilla/gecko/icons/IconResponse.java
@@ -65,17 +65,21 @@ public class IconResponse {
     private Bitmap bitmap;
     private int color;
     private boolean fromNetwork;
     private boolean fromMemory;
     private boolean fromDisk;
     private boolean generated;
     private String url;
 
-    private IconResponse(@NonNull Bitmap bitmap) {
+    private IconResponse(Bitmap bitmap) {
+        if (bitmap == null) {
+            throw new NullPointerException("Bitmap is null");
+        }
+
         this.bitmap = bitmap;
         this.color = 0;
         this.url = null;
         this.fromNetwork = false;
         this.fromMemory = false;
         this.fromDisk = false;
         this.generated = false;
     }