Merge "Prevent NPE when checking toast icon label"

This commit is contained in:
TreeHugger Robot
2021-12-22 19:34:19 +00:00
committed by Android (Google) Code Review

View File

@@ -199,7 +199,9 @@ public class SystemUIToast implements ToastPlugin.Toast {
iconView.setVisibility(View.GONE);
} else {
iconView.setImageDrawable(icon);
if (appInfo.labelRes != 0) {
if (appInfo == null) {
Log.d(TAG, "No appInfo for pkg=" + mPackageName + " usr=" + mUserId);
} else if (appInfo.labelRes != 0) {
try {
Resources res = mContext.getPackageManager().getResourcesForApplication(
appInfo,