From 02335010ff63a2906cbd538ff8b6e43d6d4b529b Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 4 Aug 2023 10:07:31 -0700 Subject: [PATCH] Don't try to get a translated empty string Hashing an empty string can be crashy. And empty strings are reserved in gettext, so we shouldn't try. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15354 --- common/tool/tool_action.cpp | 3 +++ include/tool/tool_action.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp index f57dbf20f6..c37e2b7e9c 100644 --- a/common/tool/tool_action.cpp +++ b/common/tool/tool_action.cpp @@ -123,6 +123,9 @@ TOOL_EVENT TOOL_ACTION::MakeEvent() const wxString TOOL_ACTION::GetLabel() const { + if( m_label.empty() ) + return wxEmptyString; + return wxGetTranslation( m_label ); } diff --git a/include/tool/tool_action.h b/include/tool/tool_action.h index 49cc1bdba2..4423aae114 100644 --- a/include/tool/tool_action.h +++ b/include/tool/tool_action.h @@ -299,6 +299,9 @@ public: */ TOOL_EVENT MakeEvent() const; + /** + * Return the translated label for the action. + */ wxString GetLabel() const; wxString GetMenuItem() const; wxString GetTooltip( bool aIncludeHotkey = true ) const;