All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netmon: Make sure we don't pass NULL message to g_dbus_send_message
@ 2016-10-14 16:32 Slava Monich
  2016-10-25 19:42 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Slava Monich @ 2016-10-14 16:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

Also that we don't lose the reply message.
---
 src/netmon.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/netmon.c b/src/netmon.c
index 9d6de07..eb18b9c 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);
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-25 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 16:32 [PATCH] netmon: Make sure we don't pass NULL message to g_dbus_send_message Slava Monich
2016-10-25 19:42 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.