nullptr safety

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15906
This commit is contained in:
Jeff Young 2023-10-20 16:02:03 +01:00
parent e251bbd217
commit 00fb542146
1 changed files with 11 additions and 8 deletions

View File

@ -1753,6 +1753,8 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
m_tuningPattern = PCB_TUNING_PATTERN::CreateNew( generatorTool, m_frame, m_tuningPattern = PCB_TUNING_PATTERN::CreateNew( generatorTool, m_frame,
m_pickerItem, mode ); m_pickerItem, mode );
if( m_tuningPattern )
{
int dummyDist; int dummyDist;
int dummyClearance = std::numeric_limits<int>::max() / 2; int dummyClearance = std::numeric_limits<int>::max() / 2;
VECTOR2I closestPt; VECTOR2I closestPt;
@ -1764,6 +1766,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
m_preview.Add( m_tuningPattern ); m_preview.Add( m_tuningPattern );
} }
}
else if( m_pickerItem && m_tuningPattern ) else if( m_pickerItem && m_tuningPattern )
{ {
// Second click; we're done // Second click; we're done