Fix save dialog crash on load error

If there was an error loading the HTML from Parsoid, ViewPageTarget
would try to tear down the save dialog, which caused a crash because
the save dialog doesn't exist yet at that point.

Change-Id: Ia50756a19cb775be96b90e87b642eb2a38f254ce
This commit is contained in:
Roan Kattouw 2013-10-22 01:15:35 +02:00
parent 324b04137b
commit 9d915aca2d

View file

@ -196,8 +196,11 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
this.detachToolbarButtons(); this.detachToolbarButtons();
} }
if ( this.saveDialog ) {
// If we got as far as setting up the save dialog, tear it down
this.saveDialog.reset(); this.saveDialog.reset();
this.saveDialog.close(); this.saveDialog.close();
}
// Check we got as far as setting up the surface // Check we got as far as setting up the surface
if ( this.active ) { if ( this.active ) {
// If we got as far as setting up the surface, tear that down // If we got as far as setting up the surface, tear that down