Add sanity check to dbus-exposed requestConversation()

This commit is contained in:
Nicolas Fella 2019-05-01 12:47:33 +00:00
parent 3eb2f67d38
commit c18c7b27f1

View file

@ -91,6 +91,16 @@ QVariantList ConversationsDbusInterface::activeConversations()
void ConversationsDbusInterface::requestConversation(const qint64& conversationID, int start, int end)
{
if (start < 0 || end < 0) {
qCWarning(KDECONNECT_CONVERSATIONS) << "requestConversation" << "Start and end must be >= 0";
return;
}
if (end - start < 0) {
qCWarning(KDECONNECT_CONVERSATIONS) << "requestConversation" <<"Start must be before end";
return;
}
RequestConversationWorker* worker = new RequestConversationWorker(conversationID, start, end, this);
connect(worker, &RequestConversationWorker::conversationMessageRead,
this, &ConversationsDbusInterface::conversationUpdated,