summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest Zhao <forrest.zhao@intel.com>2010-03-29 17:02:42 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2010-03-29 11:11:13 +0300
commitc5321032b046c39477ab99a05e933b13d0b67a04 (patch)
tree4de8cc4b7c99ef2fa7e0ccb327c86372e37eaf74
parent8dca8bf737718e1a9dc1e950db5c2a11978638eb (diff)
downloadbluez-c5321032b046c39477ab99a05e933b13d0b67a04.tar.gz
Return error when modem_obj_path is NULL
This could prevent crash in case modem_obj_path is NULL.
-rw-r--r--audio/telephony-ofono.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index a033701ed..52fa121c5 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -281,6 +281,12 @@ void telephony_dial_number_req(void *telephony_device, const char *number)
debug("telephony-ofono: dial request to %s", number);
+ if (!modem_obj_path) {
+ telephony_dial_number_rsp(telephony_device,
+ CME_ERROR_AG_FAILURE);
+ return;
+ }
+
if (!strncmp(number, "*31#", 4)) {
number += 4;
clir = "enabled";
@@ -311,6 +317,12 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone)
debug("telephony-ofono: transmit dtmf: %c", tone);
+ if (!modem_obj_path) {
+ telephony_transmit_dtmf_rsp(telephony_device,
+ CME_ERROR_AG_FAILURE);
+ return;
+ }
+
tone_string = g_strdup_printf("%c", tone);
ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
OFONO_VCMANAGER_INTERFACE,
@@ -531,6 +543,9 @@ done:
static int get_registration_and_signal_status()
{
+ if (!modem_obj_path)
+ return -ENOENT;
+
return send_method_call(OFONO_BUS_NAME, modem_obj_path,
OFONO_NETWORKREG_INTERFACE,
"GetProperties", get_registration_reply,