From 376fda96d5985568837ba9f493b4bef9beb92425 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 13 Mar 2019 04:00:45 +0300 Subject: [PATCH] Fix SIGSEGV. GitOrigin-RevId: 422a9080eaf83c0c35f90ec5044f2833de9837b9 --- td/mtproto/SessionConnection.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/td/mtproto/SessionConnection.cpp b/td/mtproto/SessionConnection.cpp index 7c7d300e..d215e5d6 100644 --- a/td/mtproto/SessionConnection.cpp +++ b/td/mtproto/SessionConnection.cpp @@ -988,12 +988,18 @@ Status SessionConnection::do_flush() { TRY_STATUS(raw_connection_->flush(auth_data_->get_auth_key(), *this)); if (last_pong_at_ + ping_disconnect_delay() < Time::now_cached()) { - raw_connection_->stats_callback()->on_error(); + auto stats_callback = raw_connection_->stats_callback(); + if (stats_callback != nullptr) { + stats_callback->on_error(); + } return Status::Error(PSLICE() << "Ping timeout of " << ping_disconnect_delay() << " seconds expired"); } if (last_read_at_ + read_disconnect_delay() < Time::now_cached()) { - raw_connection_->stats_callback()->on_error(); + auto stats_callback = raw_connection_->stats_callback(); + if (stats_callback != nullptr) { + stats_callback->on_error(); + } return Status::Error(PSLICE() << "Read timeout of " << read_disconnect_delay() << " seconds expired"); }