Merge pull request #7633 from atom/ns-pane-items-must-be-objects

Throw an exception when adding a non-object pane item
This commit is contained in:
Nathan Sobo
2015-07-01 14:09:14 -05:00
2 changed files with 8 additions and 0 deletions

View File

@@ -336,6 +336,8 @@ 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'
return if item in @items
if typeof item.onDidDestroy is 'function'