From 5dea708711fb10b3c02f2d8970a9ebe381feb620 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 14 Nov 2019 10:24:32 +0100 Subject: sig-comp: Fix core dump when adding a signal... Fix core dump when adding a signal with a wrong source's api name. This commit avoids the crash and throw an error through the journal log of the binding service. Bug-AGL: SPEC-2956 Change-Id: Idf052df05d76f831f56ec3c565bacf821b9b4e69 Signed-off-by: Romain Forlot --- signal-composer-binding/signal-composer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp index 9abe54e..e8e7668 100644 --- a/signal-composer-binding/signal-composer.cpp +++ b/signal-composer-binding/signal-composer.cpp @@ -259,6 +259,11 @@ int Composer::loadOneSignal(afb_api_t apihandle, json_object* signalJ) } std::string api = eventStr.substr(0, sep); src = getSourceAPI(api); + if(!src) + { + AFB_ERROR("Can't find the source API %s for the event %s. Check you configuration.", api.c_str(), eventStr.c_str()); + return -1; + } } else { -- cgit 1.2.3-korg