aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-25 07:50:02 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-04-25 07:50:02 +0900
commit5f6ac71684056aaae13335a6b867d43c8cdb1692 (patch)
treea3e60a50793d7d875e78faaf72be236766f5d84f
parent698d41f191b9a7dd2c5c1662c5f5bd6b7c2697f6 (diff)
downloadlibquotient-5f6ac71684056aaae13335a6b867d43c8cdb1692.tar.gz
libquotient-5f6ac71684056aaae13335a6b867d43c8cdb1692.zip
Avatar: don't allow null callbacks to be registered
-rw-r--r--lib/avatar.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/avatar.cpp b/lib/avatar.cpp
index a40b0ed6..7e6dc50b 100644
--- a/lib/avatar.cpp
+++ b/lib/avatar.cpp
@@ -106,6 +106,11 @@ QString Avatar::mediaId() const
QImage Avatar::Private::get(Connection* connection, QSize size,
get_callback_t callback) const
{
+ if (!callback)
+ {
+ qCCritical(MAIN) << "Null callbacks are not allowed in Avatar::get";
+ Q_ASSERT(false);
+ }
// FIXME: Alternating between longer-width and longer-height requests
// is a sure way to trick the below code into constantly getting another
// image from the server because the existing one is alleged unsatisfactory.
@@ -118,7 +123,8 @@ QImage Avatar::Private::get(Connection* connection, QSize size,
_requestedSize = size;
if (isJobRunning(_thumbnailRequest))
_thumbnailRequest->abandon();
- callbacks.emplace_back(move(callback));
+ if (callback)
+ callbacks.emplace_back(move(callback));
_thumbnailRequest = connection->getThumbnail(_url, size);
QObject::connect( _thumbnailRequest, &MediaThumbnailJob::success,
_thumbnailRequest, [this] {