From e5e0975a6302924c06da9426fca637950011ed20 Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Thu, 23 Aug 2012 14:27:34 +0100 Subject: improvements to new cell renderer branch --- src/torrent.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/torrent.c') diff --git a/src/torrent.c b/src/torrent.c index e86cda8..d605835 100644 --- a/src/torrent.c +++ b/src/torrent.c @@ -282,7 +282,7 @@ torrent_get_flags(JsonObject * t, gint64 rpcv, gint64 status, flags |= TORRENT_FLAG_ACTIVE; } - if (strlen(torrent_get_errorstr(t)) > 0) + if (torrent_get_error(t) > 0) flags |= TORRENT_FLAG_ERROR; return flags; @@ -320,6 +320,14 @@ const gchar *torrent_get_errorstr(JsonObject * t) return json_object_get_string_member(t, FIELD_ERRORSTR); } +gint64 torrent_get_error(JsonObject *t) +{ + if (!json_object_has_member(t, FIELD_ERROR)) + return 0; + else + return json_object_get_int_member(t, FIELD_ERROR); +} + gchar *torrent_get_status_string(gint64 rpcv, gint64 value, guint flags) { if (rpcv >= NEW_STATUS_RPC_VERSION) { @@ -420,7 +428,6 @@ JsonArray *get_torrents(JsonObject * response) JsonArray *torrent_get_files(JsonObject * args) { - g_assert(json_object_get_array_member(args, FIELD_FILES)); return json_object_get_array_member(args, FIELD_FILES); } -- cgit v1.2.3