From 655fa8006264c3d956b8c952b937158cfec2fb2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20=C5=A0toura=C4=8D?= <525032@mail.muni.cz>
Date: Wed, 22 May 2024 19:54:14 +0200
Subject: [PATCH] fix crash when rotating component and removing rofiworld from
 scene

---
 src/edit/src/editor.cpp | 3 +++
 src/gui/src/ui.cpp      | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/edit/src/editor.cpp b/src/edit/src/editor.cpp
index 36c6917..d2c8c44 100644
--- a/src/edit/src/editor.cpp
+++ b/src/edit/src/editor.cpp
@@ -258,6 +258,9 @@ void Editor::resetBuildModeIIVariables()
     can_connect_modules = true;
     selected_space_joints = {};
 
+    connector_selected = false;
+    voxel_selected = false;
+
     scene->manageSelection(nullptr);
     scene->manageHighlight(glm::vec3(0.0f), nullptr);
     scene->manageSecondarySelection({});
diff --git a/src/gui/src/ui.cpp b/src/gui/src/ui.cpp
index 7f2b3f0..9b4a140 100644
--- a/src/gui/src/ui.cpp
+++ b/src/gui/src/ui.cpp
@@ -879,7 +879,7 @@ void module_rotation_manual(edit::UIData &data, glm::vec3 &euler_angles)
 
 void component_rotation_ui(const osi::Window &window, edit::UIData &data)
 {
-    if (data.editor_build_mode_II != edit::build_mode_II::rotate_component || !(data.voxel_selected || data.connector_selected))
+    if (data.editor_build_mode_II != edit::build_mode_II::rotate_component || !data.selected_module || !(data.voxel_selected || data.connector_selected))
         return;
 
     float min_limit = -360.0f;
-- 
GitLab