summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-08-09 22:07:33 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-08-09 22:07:33 +0200
commit5f760687a4e81edf3dc4011129688a2eddf8b697 (patch)
treeb4bc41271332ea8cd34160bc169de2a347a96e94
parent999bbe744314ff4616271ce61a5bb57cf331e2bc (diff)
Handle possible SEGV at client_close
-rw-r--r--src/proxy.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/proxy.cc b/src/proxy.cc
index bec4924..97180ca 100644
--- a/src/proxy.cc
+++ b/src/proxy.cc
@@ -572,7 +572,12 @@ void ProxyImpl::close_client(size_t index) {
auto& client = clients_[index];
if (client.pkg_id != 0) {
size_t avail;
- auto ptr = client.in->read_ptr(&avail);
+ void const* ptr;
+ if (client.in) {
+ ptr = client.in->read_ptr(&avail);
+ } else {
+ avail = 0;
+ }
if (avail) {
send_attached_data(client.pkg_id, ptr, avail, true);
} else {