changeset 588:7a82c4b52b16

Prevent a traceback when we call Window.run without a runner set.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 08 Oct 2014 19:20:15 +0200
parents 6c9d8a3d853f
children 0768122da817
files pytouhou/ui/window.pyx
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/ui/window.pyx
+++ b/pytouhou/ui/window.pyx
@@ -78,8 +78,6 @@ cdef class Runner:
 
 cdef class Window:
     def __init__(self, backend, long fps_limit=-1):
-        self.runner = None
-
         if backend is not None:
             self.win = backend.create_window(
                 'PyTouhou',
@@ -104,7 +102,8 @@ cdef class Window:
             while self.run_frame():
                 pass
         finally:
-            self.runner.finish()
+            if self.runner is not None:
+                self.runner.finish()
 
 
     cdef bint run_frame(self) except? False: