Prevent crash when zooming to preset in footprint chooser

Partial cherry-pick of 0cf866d4

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21203
This commit is contained in:
Jon Evans 2025-06-28 19:46:42 -04:00
parent d3e5245606
commit eb3606bf57

View File

@ -460,6 +460,12 @@ int COMMON_TOOLS::doZoomToPreset( int idx, bool aCenterOnCursor )
{
std::vector<double>& zoomList = m_toolMgr->GetSettings()->m_Window.zoom_factors;
if( zoomList.empty() ) // When called from footprint chooser, zoomList is empty for some reason
zoomList = m_frame->config()->m_Window.zoom_factors;
// or: zoomList = Kiface().KifaceSettings()->m_Window.zoom_factors;
wxCHECK( !zoomList.empty(), 0 ); // To avoid a crash lower on scale from Fp Chooser panel
if( idx == 0 ) // Zoom Auto
{
TOOL_EVENT dummy;