Merge pull request #373 from oatpp/fix_wrong_loop_call_on_conditional_nullptr_issue372

Fix wrong calling of conditional loop if condition is null (Closes #372)
This commit is contained in:
Leonid Stryzhevskyi 2021-01-06 00:41:30 +02:00 committed by GitHub
commit 6b4413552a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,10 +103,14 @@ void Server::run(std::function<bool()> conditional) {
m_threaded = false;
setStatus(STATUS_CREATED, STATUS_STARTING);
m_condition = std::move(conditional);
ul.unlock(); // early unlock
conditionalMainLoop();
if (conditional) {
m_condition = std::move(conditional);
ul.unlock(); // early unlock
conditionalMainLoop();
} else {
ul.unlock();
mainLoop(this);
}
}
void Server::run(bool startAsNewThread) {