Couldn't reproduce #1851, but this should work around the error if it happens again.

This commit is contained in:
Nick Winter 2014-12-06 09:46:37 -08:00
parent 175cdb5151
commit 00e6ce5f45
2 changed files with 5 additions and 2 deletions

View file

@ -83,7 +83,7 @@ module.exports = class LevelSetupManager extends CocoClass
@inventoryModal.render()
@inventoryModal.didReappear()
@inventoryModal.onShown()
@inventoryModal.setHero(e.hero)
@inventoryModal.setHero(e.hero) if e.hero
window.tracker?.trackEvent 'Choose Inventory', category: 'Play Level', ['Google Analytics']
onChooseHeroClicked: ->

View file

@ -287,7 +287,9 @@ module.exports = class PlayHeroesModal extends ModalView
#- Exiting
saveAndHide: ->
hero = @selectedHero.get('original')
hero = @selectedHero?.get('original')
unless hero
console.error 'Somehow we tried to hide without having a hero selected yet...'
if @session
changed = @updateHeroConfig(@session, hero)
@ -311,6 +313,7 @@ module.exports = class PlayHeroesModal extends ModalView
@trigger?('confirm-click', hero: @selectedHero)
updateHeroConfig: (model, hero) ->
return false unless hero
heroConfig = _.clone(model.get('heroConfig')) or {}
if heroConfig.thangType isnt hero
heroConfig.thangType = hero