From a4f511d66823205679c7eac723ee3d23ea825fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20S=C5=82omkowski?= Date: Mon, 14 Dec 2015 22:44:32 +0100 Subject: [PATCH] Fix crash after channel linking. (cherry picked from commit 2617016) --- src/mumlib.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mumlib.cpp b/src/mumlib.cpp index 3465d6d..7bd325f 100644 --- a/src/mumlib.cpp +++ b/src/mumlib.cpp @@ -87,6 +87,8 @@ namespace mumlib { private: bool processIncomingTcpMessage(MessageType messageType, uint8_t *buffer, int length) { + logger.debug("Process incoming message: type %d, length: %d.", messageType, length); + switch (messageType) { case MessageType::VERSION: { MumbleProto::Version version; @@ -133,14 +135,19 @@ namespace mumlib { int position = channelState.has_position() ? channelState.position() : 0; vector links; - std::copy(channelState.links().begin(), channelState.links().end(), links.begin()); + for (int i = 0; i < channelState.links_size(); ++i) { + links.push_back(channelState.links(i)); + } vector links_add; - std::copy(channelState.links_add().begin(), channelState.links_add().end(), links_add.begin()); + for (int i = 0; i < channelState.links_add_size(); ++i) { + links_add.push_back(channelState.links_add(i)); + } vector links_remove; - std::copy(channelState.links_remove().begin(), channelState.links_remove().end(), - links_remove.begin()); + for (int i = 0; i < channelState.links_remove_size(); ++i) { + links_remove.push_back(channelState.links_remove(i)); + } this->channelId = channel_id;