static void tag_read_cb(uint32_t adapter_idx, uint32_t target_idx, int status)
{
+ struct near_tag *tag;
+
+ tag = near_tag_get_tag(adapter_idx, target_idx);
+
+ if (tag == NULL)
+ return;
+
+ dbus_message_unref(tag->write_msg);
+ tag->write_msg = NULL;
+
__near_adapter_start_check_presence(adapter_idx, target_idx);
__near_adapter_tags_changed(adapter_idx);
DBG("Write status %d", status);
- conn = near_dbus_get_connection();
tag = near_tag_get_tag(adapter_idx, target_idx);
+ if (tag == NULL)
+ return;
- if (conn == NULL || tag == NULL)
+ conn = near_dbus_get_connection();
+ if (conn == NULL)
goto out;
if (status != 0) {
g_dbus_send_reply(conn, tag->write_msg, DBUS_TYPE_INVALID);
}
- dbus_message_unref(tag->write_msg);
- tag->write_msg = NULL;
-
near_ndef_records_free(tag->records);
tag->n_records = 0;
tag->records = NULL;
}
out:
+ dbus_message_unref(tag->write_msg);
+ tag->write_msg = NULL;
+
__near_adapter_start_check_presence(tag->adapter_idx, tag->target_idx);
}