Merge "Fix NPE if no AutofillId when traversing the view tree."

This commit is contained in:
Joanne Chung
2021-12-10 09:33:07 +00:00
committed by Android (Google) Code Review

View File

@@ -623,7 +623,7 @@ public class UiTranslationController {
private void addViewIfNeeded(IntArray sourceViewIds, View view) {
final AutofillId autofillId = view.getAutofillId();
if ((sourceViewIds.indexOf(autofillId.getViewId()) >= 0)
if (autofillId != null && (sourceViewIds.indexOf(autofillId.getViewId()) >= 0)
&& !mViews.containsKey(autofillId)) {
mViews.put(autofillId, new WeakReference<>(view));
}