Skip to content
Permalink
Browse files

Only cache QIcons if a QgsApplication is present

  • Loading branch information
m-kuhn committed Apr 12, 2016
1 parent 30df95a commit 601e4300fa3ff7e07cf67d60ebdbf35d6bbe991e
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/core/qgsapplication.cpp
@@ -412,8 +412,8 @@ QString QgsApplication::iconPath( const QString& iconFile )

QIcon QgsApplication::getThemeIcon( const QString &theName )
{
QgsApplication* app = static_cast<QgsApplication*>( instance() );
if ( app->mIconCache.contains( theName ) )
QgsApplication* app = qobject_cast<QgsApplication*>( instance() );
if ( app && app->mIconCache.contains( theName ) )
return app->mIconCache.value( theName );

QIcon icon;
@@ -435,7 +435,8 @@ QIcon QgsApplication::getThemeIcon( const QString &theName )
icon = QIcon();
}

app->mIconCache.insert( theName, icon );
if ( app )
app->mIconCache.insert( theName, icon );
return icon;
}

0 comments on commit 601e430

Please sign in to comment.
You can’t perform that action at this time.