From 3f41c994b764820d688bb74f994d79bd471b9a47 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 22 Sep 2015 07:48:27 -0600 Subject: [PATCH] Throw exception when adding a pane item that has already been destroyed Closes atom/bracket-matcher#178 --- src/pane.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pane.coffee b/src/pane.coffee index 06ea88e47..9b9be1d79 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -355,6 +355,7 @@ class Pane extends Model # Returns the added item. addItem: (item, index=@getActiveItemIndex() + 1) -> throw new Error("Pane items must be objects. Attempted to add item #{item}.") unless item? and typeof item is 'object' + throw new Error("Adding a pane item with URI '#{item.getURI?()}' that has already been destroyed") if item.isDestroyed?() return if item in @items