wpiutil: uv::Work: Don't connect work and afterWork if they're null

This commit is contained in:
Peter Johnson
2018-09-08 00:47:51 -07:00
parent f3fb95af70
commit 164e9a2c7d

View File

@@ -39,8 +39,8 @@ void QueueWork(Loop& loop, const std::shared_ptr<WorkReq>& req) {
void QueueWork(Loop& loop, std::function<void()> work,
std::function<void()> afterWork) {
auto req = std::make_shared<WorkReq>();
req->work.connect(work);
req->afterWork.connect(afterWork);
if (work) req->work.connect(work);
if (afterWork) req->afterWork.connect(afterWork);
QueueWork(loop, req);
}