Gui: Fix null check issue in navlib

This commit is contained in:
Benjamin Nauck
2025-08-07 09:00:01 +02:00
committed by Kacper Donat
parent 321cc5ced5
commit 78e5dc9e21
2 changed files with 17 additions and 1 deletions

View File

@@ -43,6 +43,8 @@
#include <Gui/Workbench.h>
#include <Gui/WorkbenchManager.h>
#include <gsl/pointers>
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<const char*> 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());

View File

@@ -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)