Преглед изворни кода

Return empty Drawable when bridge isn't available (#1360)

Guy Carmeli пре 7 година
родитељ
комит
822afefd7e

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/react/JsDevImageLoader.java Прегледај датотеку

@@ -6,6 +6,7 @@ import android.graphics.drawable.BitmapDrawable;
6 6
 import android.graphics.drawable.Drawable;
7 7
 import android.os.StrictMode;
8 8
 import android.support.annotation.NonNull;
9
+import android.util.Log;
9 10
 
10 11
 import com.reactnativenavigation.NavigationApplication;
11 12
 
@@ -13,7 +14,7 @@ import java.io.IOException;
13 14
 import java.net.URL;
14 15
 
15 16
 public class JsDevImageLoader {
16
-
17
+    private static final String TAG = "JsDevImageLoader";
17 18
     public static Drawable loadIcon(String iconDevUri) {
18 19
         try {
19 20
             StrictMode.ThreadPolicy threadPolicy = StrictMode.getThreadPolicy();
@@ -24,7 +25,8 @@ public class JsDevImageLoader {
24 25
             StrictMode.setThreadPolicy(threadPolicy);
25 26
             return drawable;
26 27
         } catch (Exception e) {
27
-            throw new RuntimeException(iconDevUri, e);
28
+            Log.e(TAG, "Unable to load icon: " + iconDevUri);
29
+            return new BitmapDrawable();
28 30
         }
29 31
     }
30 32