From ff0c16a04245baf94b7bdfda65a476a556a0e7b2 Mon Sep 17 00:00:00 2001 From: SwimmingTiger Date: Tue, 15 Jan 2019 18:06:45 +0800 Subject: [PATCH] fix sserver crash when received a ExMessage before dispatcher_ inited. --- src/StratumSession.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/StratumSession.cc b/src/StratumSession.cc index b477d3e36..85045675d 100644 --- a/src/StratumSession.cc +++ b/src/StratumSession.cc @@ -120,7 +120,9 @@ bool StratumSession::handleMessage() { string exMessage; exMessage.resize(len); evbuffer_remove(buffer_, &exMessage.front(), exMessage.size()); - dispatcher_->handleExMessage(exMessage); + if (dispatcher_) { + dispatcher_->handleExMessage(exMessage); + } return true; // read message success, return true }