From 572ea8b3b6cf756c22a980e297c8412ae62385dd Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 26 Apr 2017 19:54:08 +0900 Subject: [PATCH] sensord: add NULL check when callbacks is called Change-Id: Ib2937c0e7ba4656c246b29a3addb1163d4494ef5 Signed-off-by: kibak.yoon --- src/client/sensor_provider_channel_handler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/sensor_provider_channel_handler.cpp b/src/client/sensor_provider_channel_handler.cpp index a537546..52cc6bf 100644 --- a/src/client/sensor_provider_channel_handler.cpp +++ b/src/client/sensor_provider_channel_handler.cpp @@ -51,16 +51,18 @@ void sensor_provider::channel_handler::read(ipc::channel *ch, ipc::message &msg) { switch (msg.type()) { case CMD_PROVIDER_START: - m_start_cb(m_provider, m_start_user_data); + if (m_start_cb) + m_start_cb(m_provider, m_start_user_data); break; case CMD_PROVIDER_STOP: - m_stop_cb(m_provider, m_stop_user_data); + if (m_stop_cb) + m_stop_cb(m_provider, m_stop_user_data); break; case CMD_PROVIDER_ATTR_INT: cmd_provider_attr_int_t buf; msg.disclose((char *)&buf); - if (buf.attribute == SENSORD_ATTRIBUTE_INTERVAL) + if (buf.attribute == SENSORD_ATTRIBUTE_INTERVAL && m_set_interval_cb) m_set_interval_cb(m_provider, buf.value, m_set_interval_user_data); break; } -- 2.7.4