Throw exception when adding a non-object pane item

This commit is contained in:
Nathan Sobo
2015-07-01 12:44:48 -05:00
parent b1d6b79ddd
commit 8348b2c039
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'