Skip to content

Commit

Permalink
Only cache QIcons if a QgsApplication is present
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 12, 2016
1 parent 30df95a commit 601e430
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 601e430

Please sign in to comment.