diff --git a/src/engine.clj b/src/engine.clj index a1ecf8f..005cb4a 100644 --- a/src/engine.clj +++ b/src/engine.clj @@ -88,11 +88,11 @@ (rl/with-drawing! (draw config updated-state) (w/watch! (watch-fn config updated-state)) - (swap! game-state updated-state) - (catch Throwable t - (doseq [buf @buffered-objs] - (restore! buf)) - (report-exception! t)))))))) + (reset! game-state updated-state))) + (catch Throwable t + (doseq [buf @buffered-objs] + (when buf (restore! buf))) + (report-exception! t)))))) (try (when unload (doseq [[_ tex] @texture-cache]