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
This commit is contained in:
jean-pierre charras 2023-01-23 11:50:27 +01:00
parent 2443d91265
commit 136c150460
1 changed files with 8 additions and 3 deletions

View File

@ -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 <font/stroke_font.h>
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() );
}