From 0c0e3c4b7cb45313a04e26b3c1c063fbe556c6c5 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 7 Jul 2017 18:17:42 +0200 Subject: Fix: compile error on maybe unitialized variable Change-Id: Iacc68e23a5d10a092b7c10f18adba4b8306365e9 Signed-off-by: Romain Forlot --- high-can-binding/high.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/high-can-binding/high.cpp b/high-can-binding/high.cpp index 097ef73..d7314e5 100644 --- a/high-can-binding/high.cpp +++ b/high-can-binding/high.cpp @@ -209,11 +209,10 @@ void High::tick(sd_event_source *source, const long &now, void *interv) jsons[pp.first] = generateJson(pp.first); } } - json_object *j; + json_object *j = json_object_new_object(); if(jsons.size() == 1) { j = jsons[0]; } else if(jsons.size() > 1) { - j = json_object_new_object(); for(const auto &pp : jsons) json_object_object_add(j, pp.first.c_str(), pp.second); } @@ -296,11 +295,10 @@ void High::treatMessage(json_object *message) jsons[pp.first] = generateJson(pp.first); } } - json_object *j; + json_object *j = json_object_new_object(); if(jsons.size() == 1) { j = jsons[0]; } else if(jsons.size() > 1) { - j = json_object_new_object(); for(const auto &pp : jsons) json_object_object_add(j, pp.first.c_str(), pp.second); } -- cgit 1.2.3-korg