From 78e5dc9e2134cb8f4fa0495b7840b1e8cfc53eb6 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Thu, 7 Aug 2025 09:00:01 +0200 Subject: [PATCH] Gui: Fix null check issue in navlib --- src/Gui/3Dconnexion/navlib/NavlibCmds.cpp | 7 ++++++- src/Gui/CMakeLists.txt | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Gui/3Dconnexion/navlib/NavlibCmds.cpp b/src/Gui/3Dconnexion/navlib/NavlibCmds.cpp index 46ad44b82a..c32747fe90 100644 --- a/src/Gui/3Dconnexion/navlib/NavlibCmds.cpp +++ b/src/Gui/3Dconnexion/navlib/NavlibCmds.cpp @@ -43,6 +43,8 @@ #include #include +#include + constexpr uint8_t LCD_ICON_SIZE = 24u; NavlibInterface::ParsedData NavlibInterface::parseCommandId(const std::string& commandId) const @@ -131,8 +133,11 @@ TDxCommand NavlibInterface::getCCommand(const Gui::Command& command, if (commandName.empty() || commandId.empty()) return TDxCommand(); + gsl::not_null commandToolTip = + command.getToolTipText() ? command.getToolTipText() : ""; + std::string commandDescription = - parameter == -1 ? command.getToolTipText() : qAction.toolTip().toStdString(); + parameter == -1 ? std::string(commandToolTip) : qAction.toolTip().toStdString(); auto newEnd = std::remove(commandName.begin(), commandName.end(), '&'); commandName.erase(newEnd, commandName.end()); diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 7913e6672d..5d343ef226 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -1,5 +1,16 @@ add_library(FreeCADGui SHARED) +if ( EXISTS "${CMAKE_SOURCE_DIR}/src/3rdParty/GSL/include" ) + include_directories( ${CMAKE_SOURCE_DIR}/src/3rdParty/GSL/include ) +else() + find_package(Microsoft.GSL) + if( Microsoft.GSL_FOUND ) + message( STATUS "Found Microsoft.GSL: version ${Microsoft.GSL_VERSION}" ) + else() + message( SEND_ERROR "The C++ Guidelines Support Library (GSL) submodule is not available. Please run git submodule update --init" ) + endif() +endif() + add_subdirectory(Stylesheets) add_subdirectory(PreferencePacks) add_subdirectory(PreferencePackTemplates)