title: How to pass a NoneType error
body: <p>I'm currently having an issue with my text adventure code, the program runs perfectly fine, but whenever the character winds up dying, the program calls this error:</p>
  
  <pre><code>    NextSceneName = CurrentScene.enter()
  AttributeError: 'NoneType' object has no attribute 'enter'
  </code></pre>
  
  <p>The program will crash after this, which is no big deal in itself. </p>
  
  <p>The code for this part of the program is:</p>
  
  <pre><code>def play(self):
          CurrentScene = self.sceneMap.OpeningScene()
          LastScene = self.sceneMap.NextScene('Finished')
  
          while CurrentScene != LastScene:
              NextSceneName = CurrentScene.enter()
              CurrentScene = self.sceneMap.NextScene(NextSceneName)
  
          CurrentScene.enter()
  </code></pre>
  
  <p>What I want to know is, how do I use something like an If statement, or a Try Except statement to pass the NoneType/AttributeError?</p>