[grilo-plugins] opensubtitles: Fix crasher when search has no results



commit 5876a19ae7bfc0e8847446c5abda36e7390fbca3
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 6 11:24:26 2015 +0100

    opensubtitles: Fix crasher when search has no results
    
    Seems that instead of listing no <data> matches, it will use an empty
    boolean. Probably a problem with the server.
    
    <member>
      <name>data</name>
      <value>
        <boolean>0</boolean>
      </value>
    </member>

 src/opensubtitles/grl-opensubtitles.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/opensubtitles/grl-opensubtitles.c b/src/opensubtitles/grl-opensubtitles.c
index 107ab4b..1009128 100644
--- a/src/opensubtitles/grl-opensubtitles.c
+++ b/src/opensubtitles/grl-opensubtitles.c
@@ -376,6 +376,10 @@ parse_results (GrlMedia    *media,
   data_val = g_hash_table_lookup (response, "data");
   if (!data_val)
     goto out;
+  if (!G_VALUE_HOLDS_BOXED (data_val)) {
+    GRL_DEBUG ("No matching subtitles in response");
+    goto out;
+  }
   data = g_value_get_boxed (data_val);
   subs = g_hash_table_new_full (g_str_hash, g_str_equal,
                                g_free, (GDestroyNotify) subtitle_data_free);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]