diff options
author | Tobrun <tobrun@mapbox.com> | 2017-12-19 09:20:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 09:20:52 +0100 |
commit | db6eaa0c348026c6afa74744a0433ccb41fe7b83 (patch) | |
tree | 0ac394226ecfbae73711b4999be5a84726194135 | |
parent | d80e71bf38f752a153dbd47944051151bf1d9772 (diff) | |
download | qtlocation-mapboxgl-db6eaa0c348026c6afa74744a0433ccb41fe7b83.tar.gz |
[android] - use default icon when compass icon fails to decode (#10694)
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java index e71d509fcf..c119d869b1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java @@ -191,6 +191,12 @@ public final class UiSettings { } private Drawable decode(byte[] bitmap) { + if (bitmap == null) { + // return default icon + return compassView.getResources().getDrawable(R.drawable.mapbox_compass_icon); + } + + // try decoding saved bitmap Bitmap compass = BitmapFactory.decodeByteArray(bitmap, 0, bitmap.length); return new BitmapDrawable(compassView.getResources(), compass); } |