Catch error when we fail to get slice icon.

Change-Id: Ia8bdf1ef8a090d2f939abf27b2308eafde7d8928
Fixes: 120588243
Test: robotests
This commit is contained in:
Fan Zhang
2018-12-06 12:02:05 -08:00
parent fec2c738ef
commit 69a56b42a1
2 changed files with 20 additions and 1 deletions

View File

@@ -449,6 +449,12 @@ public class SliceBuilderUtils {
if (iconResource == 0) {
iconResource = R.drawable.ic_settings;
}
return IconCompat.createWithResource(context, iconResource);
try {
return IconCompat.createWithResource(context, iconResource);
} catch (Exception e) {
Log.w(TAG, "Falling back to settings icon because there is an error getting slice icon "
+ data.getUri(), e);
return IconCompat.createWithResource(context, R.drawable.ic_settings);
}
}
}