[android] - use default icon when compass icon fails to decode (#10694)

This commit is contained in:
Tobrun
2017-12-19 09:20:52 +01:00
committed by GitHub
parent d80e71bf38
commit db6eaa0c34

View File

@@ -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);
}