diff --git a/muduo/net/Channel.cc b/muduo/net/Channel.cc index 1e9a40ae7..e4e7e04ce 100644 --- a/muduo/net/Channel.cc +++ b/muduo/net/Channel.cc @@ -65,10 +65,9 @@ void Channel::remove() void Channel::handleEvent(Timestamp receiveTime) { - std::shared_ptr guard; if (tied_) { - guard = tie_.lock(); + std::shared_ptr guard = tie_.lock(); if (guard) { handleEventWithGuard(receiveTime);