Index: ui/file_manager/gallery/js/gallery_item.js |
diff --git a/ui/file_manager/gallery/js/gallery_item.js b/ui/file_manager/gallery/js/gallery_item.js |
index 565067495ac31a8ed361654e43c21ad04aefe3a6..4fe4bf5995754b46be182bde820b28864925d81c 100644 |
--- a/ui/file_manager/gallery/js/gallery_item.js |
+++ b/ui/file_manager/gallery/js/gallery_item.js |
@@ -306,9 +306,11 @@ Gallery.Item.prototype.saveToFile = function( |
}).then(onSuccess.bind(null, fileEntry)) |
.catch(function(error) { |
onError(error); |
- // Disable all callbacks on the first error. |
- fileWriter.onerror = null; |
- fileWriter.onwriteend = null; |
+ if (fileWriter) { |
+ // Disable all callbacks on the first error. |
+ fileWriter.onerror = null; |
+ fileWriter.onwriteend = null; |
+ } |
}); |
}.bind(this); |