From 23ccb75e5849af9ba55389fc894b01e9f01bdd35 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sat, 28 Dec 2024 20:46:56 +0000 Subject: [PATCH] Gui: Avoid unnecessary exception in `View3DSettings::OnChange`. This gets caught in the debugger at startup, in this case its easy to avoid it. --- src/Gui/View3DSettings.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index 5caa1b3d57..b3aa7fe6d7 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -129,9 +129,11 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M else if (strcmp(Reason,"HeadlightDirection") == 0) { try { std::string pos = rGrp.GetASCII("HeadlightDirection"); - Base::Vector3f dir = Base::to_vector(pos); - for (auto _viewer : _viewers) { - _viewer->getHeadlight()->direction.setValue(dir.x, dir.y, dir.z); + if (!pos.empty()) { + Base::Vector3f dir = Base::to_vector(pos); + for (auto _viewer : _viewers) { + _viewer->getHeadlight()->direction.setValue(dir.x, dir.y, dir.z); + } } } catch (const std::exception&) { @@ -161,9 +163,11 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M else if (strcmp(Reason,"BacklightDirection") == 0) { try { std::string pos = rGrp.GetASCII("BacklightDirection"); - Base::Vector3f dir = Base::to_vector(pos); - for (auto _viewer : _viewers) { - _viewer->getBacklight()->direction.setValue(dir.x, dir.y, dir.z); + if (!pos.empty()) { + Base::Vector3f dir = Base::to_vector(pos); + for (auto _viewer : _viewers) { + _viewer->getBacklight()->direction.setValue(dir.x, dir.y, dir.z); + } } } catch (const std::exception&) {