diff --git a/test/integration/index.html b/test/integration/index.html
index e3d8dd8..50d4b69 100644
--- a/test/integration/index.html
+++ b/test/integration/index.html
@@ -29,7 +29,10 @@
vm.attachV2BitmapAdapter(new ScratchSVGRenderer.BitmapAdapter());
document.getElementById('file').addEventListener('click', e => {
- document.body.removeChild(document.getElementById('loaded'));
+ const loaded = document.getElementById('loaded');
+ if (loaded) {
+ document.body.removeChild(loaded);
+ }
});
document.getElementById('file').addEventListener('change', e => {