From 501c79f55b5f6cb5df80993330d0b1ae1764024a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 10 Dec 2018 16:32:33 +0900 Subject: Room::getPreviousContent: use early return ...instead of the entire function body wrapped in an if block. --- lib/room.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/room.cpp b/lib/room.cpp index 84072d3e..3cbd2271 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1440,18 +1440,18 @@ void Room::getPreviousContent(int limit) void Room::Private::getPreviousContent(int limit) { - if( !isJobRunning(eventsHistoryJob) ) - { - eventsHistoryJob = - connection->callApi(id, prevBatch, "b", "", limit); - emit q->eventsHistoryJobChanged(); - connect( eventsHistoryJob, &BaseJob::success, q, [=] { - prevBatch = eventsHistoryJob->end(); - addHistoricalMessageEvents(eventsHistoryJob->chunk()); - }); - connect( eventsHistoryJob, &QObject::destroyed, - q, &Room::eventsHistoryJobChanged); - } + if (isJobRunning(eventsHistoryJob)) + return; + + eventsHistoryJob = + connection->callApi(id, prevBatch, "b", "", limit); + emit q->eventsHistoryJobChanged(); + connect( eventsHistoryJob, &BaseJob::success, q, [=] { + prevBatch = eventsHistoryJob->end(); + addHistoricalMessageEvents(eventsHistoryJob->chunk()); + }); + connect( eventsHistoryJob, &QObject::destroyed, + q, &Room::eventsHistoryJobChanged); } void Room::inviteToRoom(const QString& memberId) -- cgit v1.2.3