Fix NPE in findSingleTargetFromSubtypes()
Change-Id: I29b8994cf2521694474f80f41466efccde6aeb29
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
index 797d178..f21bf79 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
@@ -1076,7 +1076,11 @@
// If the candidate is reachable, we already have a previous result.
DexEncodedMethod result = candidateIsReachable ? candidate : null;
for (DexType subtype : allImmediateExtendsSubtypes(clazz.type)) {
- DexProgramClass subclass = definitionFor(subtype).asProgramClass();
+ DexProgramClass subclass = asProgramClassOrNull(definitionFor(subtype));
+ if (subclass == null) {
+ // Can't guarantee a single target.
+ return DexEncodedMethod.SENTINEL;
+ }
DexEncodedMethod target = subclass.lookupVirtualMethod(method);
if (target != null && !target.isPrivateMethod()) {
// We found a method on this class. If this class is not abstract it is a runtime