From 136c1504602e08ad45d5084fe91c731fd4767e37 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 23 Jan 2023 11:50:27 +0100 Subject: [PATCH] plot_brditems_plotter: fix crash (null poiner use) when run from kicad-cli, with a not initialized plotter render settings. Fixes #13633 https://gitlab.com/kicad/code/kicad/issues/13633 --- pcbnew/plot_brditems_plotter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 4a73b1f79a..80403192a4 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -409,7 +409,9 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4 if( !font ) { - font = KIFONT::FONT::GetFont( m_plotter->RenderSettings()->GetDefaultFont(), + font = KIFONT::FONT::GetFont( m_plotter->RenderSettings() + ? m_plotter->RenderSettings()->GetDefaultFont() + : wxString( wxEmptyString ), aText->IsBold(), aText->IsItalic() ); } @@ -784,13 +786,16 @@ void BRDITEMS_PLOTTER::PlotFootprintShape( const FP_SHAPE* aShape ) } +#include void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout ) { KIFONT::FONT* font = aText->GetFont(); if( !font ) { - font = KIFONT::FONT::GetFont( m_plotter->RenderSettings()->GetDefaultFont(), + font = KIFONT::FONT::GetFont( m_plotter->RenderSettings() + ? m_plotter->RenderSettings()->GetDefaultFont() + : wxString( wxEmptyString ), aText->IsBold(), aText->IsItalic() ); }