Don't crash if an on-demand imported package doesn't exist

This can happen with the reduced classpath optimization enabled, since
imports (and packages) are not currently subject to strict deps
enforcement.

MOE_MIGRATED_REVID=138526768
diff --git a/java/com/google/turbine/binder/lookup/WildImportIndex.java b/java/com/google/turbine/binder/lookup/WildImportIndex.java
index 0ef3ab5..6438479 100644
--- a/java/com/google/turbine/binder/lookup/WildImportIndex.java
+++ b/java/com/google/turbine/binder/lookup/WildImportIndex.java
@@ -85,7 +85,11 @@
   @Override
   public LookupResult lookup(LookupKey lookup) {
     for (Supplier<Scope> packageScope : packages) {
-      LookupResult result = packageScope.get().lookup(lookup);
+      Scope scope = packageScope.get();
+      if (scope == null) {
+        continue;
+      }
+      LookupResult result = scope.lookup(lookup);
       if (result != null) {
         return result;
       }
diff --git a/javatests/com/google/turbine/binder/BinderTest.java b/javatests/com/google/turbine/binder/BinderTest.java
index 5c2988b..f389560 100644
--- a/javatests/com/google/turbine/binder/BinderTest.java
+++ b/javatests/com/google/turbine/binder/BinderTest.java
@@ -212,6 +212,30 @@
     assertThat(a.interfaces()).containsExactly(new ClassSymbol("java/util/Map$Entry"));
   }
 
+  @Test
+  public void missingWildImport() throws Exception {
+    List<Tree.CompUnit> units = new ArrayList<>();
+    units.add(
+        parseLines(
+            "package lib;", //
+            "public class Lib {",
+            "  public static class Inner {}",
+            "}"));
+    units.add(
+        parseLines(
+            "package other;", //
+            "import no.such.*;",
+            "import lib.Lib.*;",
+            "public class Foo extends Inner {",
+            "}"));
+
+    ImmutableMap<ClassSymbol, SourceTypeBoundClass> bound =
+        Binder.bind(units, Collections.emptyList(), BOOTCLASSPATH).units();
+
+    assertThat(bound.get(new ClassSymbol("other/Foo")).superclass())
+        .isEqualTo(new ClassSymbol("lib/Lib$Inner"));
+  }
+
   private Tree.CompUnit parseLines(String... lines) {
     return Parser.parse(Joiner.on('\n').join(lines));
   }