From 4259890685f4390a7d5f1d7ab832ab08edf96de0 Mon Sep 17 00:00:00 2001
From: Max <m.giller.dev@gmail.com>
Date: Mon, 19 Jul 2021 10:44:14 +0200
Subject: [PATCH] Fixed null exception

---
 editor/js/state.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/editor/js/state.js b/editor/js/state.js
index 9e36c27..553509d 100644
--- a/editor/js/state.js
+++ b/editor/js/state.js
@@ -34,13 +34,17 @@ class State extends Tool {
             return;
         }
 
-        this.tool.onToolDeactivate(tool);
+        if (this.tool !== undefined) {
+            this.tool.onToolDeactivate(tool);
+        }
 
         this.previousTool = this.tool;
         this.tool = tool;
         this.display.setSelectedTool(tool);
 
-        this.tool.onToolActivate();
+        if (this.tool !== undefined) {
+            this.tool.onToolActivate();
+        }
     }
 
     setSelectedItem(item) {
-- 
GitLab