From 10d344504a7c812166b14c78871d0102c39d2c08 Mon Sep 17 00:00:00 2001
From: Scott Erickson <sderickson@gmail.com>
Date: Fri, 8 Jul 2016 13:27:42 -0700
Subject: [PATCH] Add check to TomeView

Found a bug while playing Ogre Encampment: click the Chest before clicking past the
intro screen and the game throws an error, when `updateSpellPalette` tries to access
call `spell.getSource()` but `spell` is undefined. This check keeps the same behavior
but handles the error.
---
 app/views/play/level/tome/TomeView.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/views/play/level/tome/TomeView.coffee b/app/views/play/level/tome/TomeView.coffee
index 98a11b42d..442b8cf4b 100644
--- a/app/views/play/level/tome/TomeView.coffee
+++ b/app/views/play/level/tome/TomeView.coffee
@@ -202,7 +202,7 @@ module.exports = class TomeView extends CocoView
     spell = @spellFor thang, spellName
     unless spell?.canRead()
       @clearSpellView()
-      @updateSpellPalette thang, spell
+      @updateSpellPalette thang, spell if spell
       return
     unless spell.view is @spellView
       @clearSpellView()