From c5c7cde4a0cc64c6a0741833febad6b4e460200d Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Thu, 30 Oct 2014 14:09:07 +0300 Subject: [PATCH] Update twister.cpp More checks to be sure DM is in new format --- src/twister.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/twister.cpp b/src/twister.cpp index 5f0faadc..c9d7a992 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -1092,9 +1092,13 @@ bool processReceivedDM(lazy_entry const* post) libtorrent::error_code ec; if (lazy_bdecode(textOut.data(), textOut.data()+textOut.size(), v, ec, &pos) == 0 && v.type() == lazy_entry::dict_t) { - msg = v.dict_find_string_value("msg"); - to = v.dict_find_string_value("to"); - // new features here: key distribution etc + lazy_entry const* pMsg = v.dict_find_string("msg"); + lazy_entry const* pTo = v.dict_find_string("to"); + if (pMsg && pTo) { + msg = pMsg->string_value(); + to = pTo->string_value(); + // new features here: key distribution etc + } } }