Don't build super image if source images are missing

For some internal branches, vendor.img isn't built, so there
is no need to build super image / super split images there.

Test: remove vendor.img and VENDOR/ from target_files_intermediates, then
      run add_img_to_target_files
Fixes: 120634805

Change-Id: I2834a27ce232538f203733c204dd257279c789fc
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 669d87b..1872a58 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -657,12 +657,13 @@
   """Create split super_*.img and store it in output_zip."""
 
   outdir = os.path.join(OPTIONS.input_tmp, "OTA")
-  build_super_image.BuildSuperImage(OPTIONS.input_tmp, outdir)
+  built = build_super_image.BuildSuperImage(OPTIONS.input_tmp, outdir)
 
-  for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
-    img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
-                     "super_" + dev + ".img")
-    img.Write()
+  if built:
+    for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
+      img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
+                       "super_" + dev + ".img")
+      img.Write()
 
 
 def ReplaceUpdatedFiles(zip_filename, files_list):