From 440322eb73a16e2afbe118e457cc0a69aea41e3f Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 19 Jul 2015 20:21:21 +0200 Subject: The callback is supposed to be always there --- common/resourceaccess.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 038e240..78a5155 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -273,12 +273,12 @@ void ResourceAccess::sendCommand(const QSharedPointer &command) d->messageId++; const auto messageId = d->messageId; log(QString("Sending command \"%1\" with messageId %2").arg(QString(Akonadi2::Commands::name(command->commandId))).arg(d->messageId)); - if (command->callback) { - registerCallback(d->messageId, [this, messageId, command](int errorCode, QString errorMessage) { - d->pendingCommands.remove(messageId); - command->callback(errorCode, errorMessage); - }); - } + Q_ASSERT(command->callback); + registerCallback(d->messageId, [this, messageId, command](int errorCode, QString errorMessage) { + Trace() << "Command complete " << messageId; + d->pendingCommands.remove(messageId); + command->callback(errorCode, errorMessage); + }); //Keep track of the command until we're sure it arrived d->pendingCommands.insert(d->messageId, command); Commands::write(d->socket.data(), d->messageId, command->commandId, command->buffer.constData(), command->buffer.size()); -- cgit v1.2.3