diff options
author | Slava Monich <slava.monich@jolla.com> | 2016-10-14 19:32:05 +0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2016-10-25 14:41:53 -0500 |
commit | 5c486138baa08b9876830f1509e77ce720a2d071 (patch) | |
tree | 2bc5c384dfc356c5269249851a83c5f0a5035019 | |
parent | c31a27c180dbb99aa6e218ed17ba6dcd7a412cac (diff) | |
download | ofono-5c486138baa08b9876830f1509e77ce720a2d071.tar.gz |
netmon: Fix corner cases in serving cell info
Make sure we don't pass NULL message to g_dbus_send_message
Also that we don't lose the reply message.
-rw-r--r-- | src/netmon.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/netmon.c b/src/netmon.c index 9d6de075..eb18b9c0 100644 --- a/src/netmon.c +++ b/src/netmon.c @@ -199,9 +199,24 @@ static void serving_cell_info_callback(const struct ofono_error *error, struct ofono_netmon *netmon = data; DBusMessage *reply = netmon->reply; - if (error->type != OFONO_ERROR_TYPE_NO_ERROR) + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { + if (reply) + dbus_message_unref(reply); + reply = __ofono_error_failed(netmon->pending); + } else if (!reply) { + DBusMessageIter iter; + DBusMessageIter dict; + + reply = dbus_message_new_method_return(netmon->pending); + dbus_message_iter_init_append(reply, &iter); + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, + OFONO_PROPERTIES_ARRAY_SIGNATURE, + &dict); + dbus_message_iter_close_container(&iter, &dict); + } + netmon->reply = NULL; __ofono_dbus_pending_reply(&netmon->pending, reply); } |