diff --git a/saveSvgAsPng.js b/saveSvgAsPng.js
index <HASH>..<HASH> 100644
--- a/saveSvgAsPng.js
+++ b/saveSvgAsPng.js
@@ -36,6 +36,13 @@
             callback();
           }
         }
+        img.onerror = function() {
+          console.log("Could not load "+image.getAttribute('xlink:href'));
+          left--;
+          if (left == 0) {
+            callback();
+          }
+        }
       })(images[i]);
     }
   }
Handle images that fail to load.