From 6ba2a9c639f80bfbad6456774645ed017b5f1ab1 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 5 May 2014 11:40:49 +0100 Subject: [PATCH] Don't crash if we could not add a font. --- src/libtomahawk/utils/TomahawkStyle.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/utils/TomahawkStyle.cpp b/src/libtomahawk/utils/TomahawkStyle.cpp index f57e358a8..099dfab63 100644 --- a/src/libtomahawk/utils/TomahawkStyle.cpp +++ b/src/libtomahawk/utils/TomahawkStyle.cpp @@ -213,8 +213,15 @@ TomahawkStyle::loadFonts() QDir dir( ":/data/fonts" ); foreach ( const QString& fileName, dir.entryList() ) { - tDebug() << "Trying to add font resource:" << fileName; + tDebug( LOGVERBOSE ) << "Trying to add font resource:" << fileName; const int id = QFontDatabase::addApplicationFont( ":/data/fonts/" + fileName ); - tDebug() << "Added font:" << id << QFontDatabase::applicationFontFamilies( id ).first(); + if ( id >= 0 ) + { + tDebug( LOGVERBOSE ) << "Added font:" << id << QFontDatabase::applicationFontFamilies( id ).first(); + } + else + { + tDebug() << "Could not add font resource:" << fileName; + } } }