Fix crashes when settings manager doesn't exist yet.

This commit is contained in:
Jeff Young
2025-08-14 11:33:25 +01:00
parent dafc9dd05a
commit 33c73d7db4
8 changed files with 85 additions and 75 deletions
+5 -8
View File
@@ -207,18 +207,15 @@ wxImage BITMAP_STORE::getImage( BITMAPS aBitmapId, int aHeight )
void BITMAP_STORE::ThemeChanged()
{
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
wxString oldTheme = m_theme;
wxString oldTheme = m_theme;
if( settings )
if( COMMON_SETTINGS* settings = Pgm().GetCommonSettings() )
{
switch( settings->m_Appearance.icon_theme )
{
case ICON_THEME::LIGHT: m_theme = wxT( "light" ); break;
case ICON_THEME::DARK: m_theme = wxT( "dark" ); break;
case ICON_THEME::AUTO:
m_theme = KIPLATFORM::UI::IsDarkTheme() ? wxT( "dark" ) : wxT( "light" );
break;
case ICON_THEME::LIGHT: m_theme = wxT( "light" ); break;
case ICON_THEME::DARK: m_theme = wxT( "dark" ); break;
case ICON_THEME::AUTO: m_theme = KIPLATFORM::UI::IsDarkTheme() ? wxT( "dark" ) : wxT( "light" ); break;
}
}
else