Check for null drawable in theme-less getDrawable()

BUG: 18507509
Change-Id: I64e2950dc3a30f3979ec179789a6f6e055c9f86d
This commit is contained in:
Alan Viverette
2014-11-24 11:27:09 -08:00
parent 29dc496a42
commit 7e0aaae3db

View File

@@ -747,7 +747,7 @@ public class Resources {
*/
public Drawable getDrawable(int id) throws NotFoundException {
final Drawable d = getDrawable(id, null);
if (d.canApplyTheme()) {
if (d != null && d.canApplyTheme()) {
Log.w(TAG, "Drawable " + getResourceName(id) + " has unresolved theme "
+ "attributes! Consider using Resources.getDrawable(int, Theme) or "
+ "Context.getDrawable(int).", new RuntimeException());