GError* err = nullptr;
GDBusMessage* reply = g_dbus_connection_send_message_with_reply_finish(conn,
res, &err);
- if (reply == nullptr) {
- LOGE("No reply. err(%s)", err ? err->message : "Unknown");
- if (err && err->code == G_IO_ERROR_CANCELLED) {
- g_error_free(err);
- return;
- }
+
+ if (err && err->code == G_IO_ERROR_CANCELLED) {
+ g_error_free(err);
+ LOGE("IO error cancelled");
+ return;
}
FdBroker* broker = static_cast<FdBroker*>(user_data);
+ if (broker == nullptr) {
+ LOGW("Null broker");
+ return;
+ }
IEventWatcher* watcher = broker->watcher_;
if (err) {
watcher->OnPortDisconnected(broker->watch_appid_, broker->watch_port_name_,
true);
g_error_free(err);
- if (broker && broker->cancellable_) {
+ if (broker->cancellable_) {
LOGW("Cancel the send request");
g_cancellable_cancel(broker->cancellable_);
g_object_unref(broker->cancellable_);
return;
}
+ if (reply == nullptr) {
+ LOGW("Null reply");
+ return;
+ }
+
GVariant* reply_body = g_dbus_message_get_body(reply);
if (reply_body == nullptr) {
LOGE("g_dbus_message_get_body() is failed");