From dba149447c12ab06482cc9cccfbb4601a97f93fb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 26 Apr 2025 18:19:05 +0200 Subject: [PATCH] Footprint chooser frame: fix crash in COMMON_TOOLS::ResetLocalCoords() The crash was due to a null pointer thta can happens in Footprint chooser, frame, when hit the space bar if the canvas showing the Fp has the focus. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20780 (cherry picked from commit 34e49758d078b6b4709c96073f70fd19fdf67281) --- common/tool/common_tools.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 9e1f4c0fca..5c7e9506fd 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -679,6 +679,9 @@ int COMMON_TOOLS::TogglePolarCoords( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ResetLocalCoords( const TOOL_EVENT& aEvent ) { + if( !m_frame->GetScreen() ) // Can happen in footprint chooser frame + return 0; + const KIGFX::VC_SETTINGS& vcSettings = m_toolMgr->GetCurrentToolVC(); // Use either the active tool forced cursor position or the general settings