[Autofill Assistant] Fix failing test in generic UI.

The test was failing because it tried to resolve resources that were not available on the target platform. This CL fixes this issue by instead resolving only resources that are bundled with autofill_assistant.

This CL also fixes the issue that autofill_assistant would crash if it failed to resolve the resources.

Bug: 1033877
Change-Id: Ie63d0630a0debd473b2f183af3efebf5d647dbf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1969581
Auto-Submit: Clemens Arbesser <arbesser@google.com>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Commit-Queue: Sandro Maggi <sandromaggi@google.com>
Reviewed-by: Sandro Maggi <sandromaggi@google.com>
Cr-Commit-Position: refs/heads/master@{#725142}
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
index ed7d90b4..ba9e4c5 100644
--- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
+++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
@@ -174,14 +174,14 @@
                                         .setStrokeWidth(ClientDimensionProto.newBuilder().setDp(1)))
                         .build();
 
-        ViewProto locationImage = createTestImage("ic_place_googblue_36dp", "locationImage");
+        ViewProto locationImage = createTestImage("ic_add_outline_white_24dp", "locationImage");
         ViewProto locationTextView =
                 createTextView("345 Spear Street, San Francisco", "locationText");
         ViewProto locationChevron = createTestImage("ic_expand_more_black_24dp", "locationChevron");
         ViewProto locationSection = createSectionView(
                 Arrays.asList(locationImage, locationTextView, locationChevron), "locationSection");
 
-        ViewProto cardImage = createTestImage("ic_folder_blue_24dp", "cardImage");
+        ViewProto cardImage = createTestImage("ic_remove_outline_white_24dp", "cardImage");
         ViewProto cardTextView = createTextView("Visa •••• 1111", "cardText");
         ViewProto cardChevron = createTestImage("ic_expand_more_black_24dp", "cardChevron");
         ViewProto cardSection = createSectionView(
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc
index 8d8301f..08d6a36 100644
--- a/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc
+++ b/chrome/browser/android/autofill_assistant/generic_ui_controller_android.cc
@@ -175,8 +175,11 @@
 
   if (proto.view_case() == ViewProto::kViewContainer) {
     for (const auto& child : proto.view_container().views()) {
-      Java_AssistantViewFactory_addViewToContainer(
-          env, jview, CreateJavaView(env, jcontext, jdelegate, child, views));
+      auto jchild = CreateJavaView(env, jcontext, jdelegate, child, views);
+      if (!jchild) {
+        return nullptr;
+      }
+      Java_AssistantViewFactory_addViewToContainer(env, jview, jchild);
     }
   }