From 2ad715a7d4c12c786dd495c2bbb50e8378e00a5b Mon Sep 17 00:00:00 2001 From: Weifeng Li <619254993@qq.com> Date: Sat, 10 Dec 2022 00:46:41 +0800 Subject: [PATCH] Issue #131 [fix] fix crash in description of this issue --- AUTHORS | 1 + src/zk/connection_zk.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 8ced9a4..649de1f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,3 +2,4 @@ Contributors ============ Travis Gockel +Weifeng Li <619254993@qq.com> diff --git a/src/zk/connection_zk.cpp b/src/zk/connection_zk.cpp index c4e9dbc..afee19d 100644 --- a/src/zk/connection_zk.cpp +++ b/src/zk/connection_zk.cpp @@ -337,7 +337,7 @@ future connection_zk::get(string_view path) std::unique_ptr> prom((ptr>) prom_in); auto rc = error_code_from_raw(rc_in); if (rc == error_code::ok) - prom->set_value(get_result(buffer(data, data + data_sz), stat_from_raw(*pstat))); + prom->set_value(get_result(data ? buffer(data, data + data_sz) : buffer(), stat_from_raw(*pstat))); else prom->set_exception(get_exception_ptr_of(rc)); }; @@ -376,7 +376,7 @@ class connection_zk::data_watcher : if (rc == error_code::ok) { - self.deliver_data(watch_result(get_result(buffer(data, data + data_sz), stat_from_raw(*pstat)), + self.deliver_data(watch_result(get_result(data ? buffer(data, data + data_sz) : buffer(), stat_from_raw(*pstat)), self.get_event_future() ), zk::exception_ptr()