Add more parent safety checks

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21317
This commit is contained in:
Seth Hillbrand 2025-08-23 14:13:20 -07:00
parent a7772e3b91
commit e346139301
2 changed files with 5 additions and 3 deletions

View File

@ -326,7 +326,9 @@ void COLOR_SWATCH::GetNewSwatchColor()
void COLOR_SWATCH::OnDarkModeToggle() void COLOR_SWATCH::OnDarkModeToggle()
{ {
m_checkerboardBg = m_parent->GetBackgroundColour(); wxWindow* parent = GetParent();
m_checkerboardBg = parent ? parent->GetBackgroundColour() : wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
m_swatch->SetBitmap( makeBitmap() ); if( m_swatch )
m_swatch->SetBitmap( makeBitmap() );
} }

View File

@ -70,7 +70,7 @@ PANEL_ESERIES_DISPLAY::PANEL_ESERIES_DISPLAY( wxWindow * parent, wxWindowID id,
// making the value boxes appear to be separated from each other. // making the value boxes appear to be separated from each other.
// Also force text to always be black so it is visible against the light // Also force text to always be black so it is visible against the light
// colored cells in both light and dark modes. // colored cells in both light and dark modes.
wxColour gridLineColour = parent->GetBackgroundColour(); wxColour gridLineColour = parent ? parent->GetBackgroundColour() : wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
m_GridEseries112->SetDefaultCellTextColour( *wxBLACK ); m_GridEseries112->SetDefaultCellTextColour( *wxBLACK );
m_GridEseries112->SetGridLineColour( gridLineColour ); m_GridEseries112->SetGridLineColour( gridLineColour );