Only try to close save dialog before destroying surface if it's currently open

Otherwise the closure promise will be rejected as it was already closed with
different data, if you ever opened and closed the save dialog before pressing
the 'Read' button. This means the code in the $.when will never be run, and
the surface never destroyed.

Bug: T75589
Change-Id: I3ffdd1c82506bcd2accc0f3fa113c0950a31918e
This commit is contained in:
Alex Monk 2014-11-22 15:31:45 +00:00
parent 268a852455
commit 1c04d32d75

View file

@ -1082,7 +1082,7 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
this.surface.mwTocWidget.teardown();
}
if ( this.saveDialog ) {
if ( this.saveDialog && this.saveDialog.isOpened() ) {
// If the save dialog is still open (from saving) close it
promises.push( this.saveDialog.close() );
// Release the reference