mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Couldn't reproduce #1851, but this should work around the error if it happens again.
This commit is contained in:
parent
175cdb5151
commit
00e6ce5f45
2 changed files with 5 additions and 2 deletions
|
@ -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: ->
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue