From a02dce9db1fb76ba42dc9522dc8673a3e8b39858 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 11 Sep 2014 17:07:23 +0200 Subject: [PATCH] * Assert when image with negative size is being requested. --- src/libtomahawk/utils/ImageRegistry.cpp | 6 ++++++ src/libtomahawk/utils/TomahawkUtilsGui.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/libtomahawk/utils/ImageRegistry.cpp b/src/libtomahawk/utils/ImageRegistry.cpp index 0ced33387..17e6eb8f3 100644 --- a/src/libtomahawk/utils/ImageRegistry.cpp +++ b/src/libtomahawk/utils/ImageRegistry.cpp @@ -57,6 +57,12 @@ ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint ) QPixmap ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::ImageMode mode, float opacity, QColor tint ) { + if ( size.width() < 0 || size.height() < 0 ) + { + Q_ASSERT( false ); + return QPixmap(); + } + QHash< qint64, QPixmap > subsubcache; QHash< int, QHash< qint64, QPixmap > > subcache; diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index be45cb725..1fb184c6c 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -478,6 +478,11 @@ QPixmap defaultPixmap( ImageType type, ImageMode mode, const QSize& size ) { QPixmap pixmap; + if ( size.width() < 0 || size.height() < 0 ) + { + Q_ASSERT( false ); + return pixmap; + } switch ( type ) {