mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Merge pull request #8892 from atom/ns-throw-when-adding-destroyed-pane-items
Throw exception when adding a pane item that has already been destroyed
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user