From 94be4050bc5f53df05b301719ffb269b999b8c99 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 15 Dec 2018 14:37:23 +0800 Subject: [PATCH] network/packet: Fix reading vectors/arrays of strings Previously would break here, as it is trying to initialize a string with 0, which is then considered NULL. --- src/network/packet.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/packet.h b/src/network/packet.h index 5a2e58dc20..7bdc3da958 100644 --- a/src/network/packet.h +++ b/src/network/packet.h @@ -126,7 +126,7 @@ Packet& Packet::operator>>(std::vector& out_data) { // Then extract the data for (std::size_t i = 0; i < out_data.size(); ++i) { - T character = 0; + T character; *this >> character; out_data[i] = character; } @@ -136,7 +136,7 @@ Packet& Packet::operator>>(std::vector& out_data) { template Packet& Packet::operator>>(std::array& out_data) { for (std::size_t i = 0; i < out_data.size(); ++i) { - T character = 0; + T character; *this >> character; out_data[i] = character; }