Minor fixes after main dex list refactoring

Change-Id: I492eec90b861fea158e251fcdf23284888238ffd
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfo.java b/src/main/java/com/android/tools/r8/graph/AppInfo.java
index fa5241f..c49eb28 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfo.java
@@ -106,7 +106,7 @@
   public void addSynthesizedClass(DexProgramClass clazz, boolean addToMainDexClasses) {
     assert checkIfObsolete();
     syntheticItems.addSyntheticClass(clazz);
-    if (addToMainDexClasses) {
+    if (addToMainDexClasses && !mainDexClasses.isEmpty()) {
       mainDexClasses.add(clazz);
     }
   }
diff --git a/src/test/java/com/android/tools/r8/utils/codeinspector/CodeInspector.java b/src/test/java/com/android/tools/r8/utils/codeinspector/CodeInspector.java
index 8672caa..6a5b949 100644
--- a/src/test/java/com/android/tools/r8/utils/codeinspector/CodeInspector.java
+++ b/src/test/java/com/android/tools/r8/utils/codeinspector/CodeInspector.java
@@ -82,7 +82,8 @@
   }
 
   public CodeInspector(Path file, Path mappingFile) throws IOException {
-    this(Collections.singletonList(file), mappingFile.toString(), null);
+    this(
+        Collections.singletonList(file), mappingFile != null ? mappingFile.toString() : null, null);
   }
 
   public CodeInspector(Path file) throws IOException {