Index: chrome/browser/resources/file_manager/js/image_editor/image_editor.js |
diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_editor.js b/chrome/browser/resources/file_manager/js/image_editor/image_editor.js |
index e8a79797fc59f08f0679852c42fc103ec2281307..ce24d93234c2e0ab1571a8c5e5e28413dda4c6f7 100644 |
--- a/chrome/browser/resources/file_manager/js/image_editor/image_editor.js |
+++ b/chrome/browser/resources/file_manager/js/image_editor/image_editor.js |
@@ -367,8 +367,11 @@ ImageEditor.prototype.leaveMode = function(commit) { |
this.currentMode_.cleanUpUI(); |
if (commit) { |
var self = this; |
- this.commandQueue_.execute(this.currentMode_.getCommand()); |
- this.updateUndoRedo(); |
+ var command = this.currentMode_.getCommand(); |
+ if (command) { // Could be null if the user did not do anything. |
+ this.commandQueue_.execute(command); |
+ this.updateUndoRedo(); |
+ } |
} |
this.currentMode_.cleanUpCaches(); |
this.currentMode_ = null; |