changeset 225:277d92d29a3d

Irccdctl: fix invalid response comparison
author David Demelier <markand@malikania.fr>
date Thu, 14 Jul 2016 15:11:36 +0200
parents 01fc0e526a9d
children 127142e02526
files lib/irccd/connection.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/irccd/connection.cpp	Thu Jul 14 10:47:20 2016 +0200
+++ b/lib/irccd/connection.cpp	Thu Jul 14 15:11:36 2016 +0200
@@ -18,6 +18,7 @@
 
 #include "connection.hpp"
 #include "logger.hpp"
+#include "util.hpp"
 
 namespace irccd {
 
@@ -26,9 +27,10 @@
     m_timer.reset();
 
     for (;;) {
-        nlohmann::json object = next(clamp(timeout));
+        auto object = next(clamp(timeout));
+        auto response = object.find("response");
 
-        if (object.is_object() && object["response"].dump() == name)
+        if (response != object.end() && util::json::toString(*response) == name)
             return object;
     }