buffer.js: Fix this.container.selectedPanel is undefined error
authorJeremy Maitin-Shepard <jeremy@jeremyms.com>
Wed, 15 Jan 2014 22:00:04 +0000 (15 14:00 -0800)
committerJeremy Maitin-Shepard <jeremy@jeremyms.com>
Wed, 12 Feb 2014 02:40:59 +0000 (11 18:40 -0800)
This occurs with Gecko >= 25

modules/buffer.js

index d317546..b5251a6 100644 (file)
@@ -588,10 +588,14 @@ buffer_container.prototype = {
         // exists.
         var element = b.element;
         b.destroy();
+
+        // Switch to new buffer before destroying this buffer so that
+        // there always remains a selected buffer
+        this._switch_to(new_buffer);
+
         this.container.removeChild(element);
         this.buffer_list.splice(this.buffer_list.indexOf(b), 1);
         this.buffer_history.splice(this.buffer_history.indexOf(b), 1);
-        this._switch_to(new_buffer);
         if (changed) {
             select_buffer_hook.run(new_buffer);
             this.buffer_history.splice(this.buffer_history.indexOf(new_buffer), 1);