changeset 1394:2e25c7a29ac2

fixed crashes
author Cristi Magherusan <majeru@atheme-project.org>
date Sat, 28 Jul 2007 14:45:30 +0300
parents d872ca28881f
children 761e17b23e0c
files src/lastfm/lastfm.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lastfm/lastfm.c	Sat Jul 28 01:30:34 2007 +0300
+++ b/src/lastfm/lastfm.c	Sat Jul 28 14:45:30 2007 +0300
@@ -75,7 +75,7 @@
         curl_easy_setopt(curl, CURLOPT_WRITEDATA, res);
         gint status = curl_easy_perform(curl);
         curl_easy_cleanup(curl);
-        g_print(res->str);
+        /* g_print(res->str);*/
         if((status==CURLE_OK) && res && res->str)
                 result = g_strsplit(res->str, "\n", 20);
         g_string_erase(res, 0, -1);
@@ -274,19 +274,20 @@
 
 int fetch_metadata(LastFM * handle)
 {
-g_print("LASTFM: (fetch) starting to fetch\n");
+#if DEBUG
+        g_print("LASTFM: (fetch) starting to fetch\n");
+#endif
         gchar *uri=NULL;
         gint res=METADATA_FETCH_FAILED;
-        if(handle->lastfm_session_id == NULL)
-                handle->lastfm_session_id=g_strdup(mowgli_global_storage_get("lastfm_session_id"));
-        g_print("session %s\n",handle->lastfm_session_id);
+        if(handle==NULL)
+                return res;
+
+        handle->lastfm_session_id=mowgli_global_storage_get("lastfm_session_id");
         if (handle->lastfm_session_id == NULL)
                 return res;
         uri=g_strdup_printf(LASTFM_METADATA_URL, handle->lastfm_session_id);
-        g_print("uri %s\n",uri);
         gchar**fetched_metadata =NULL;
         fetched_metadata = lastfm_get_data_from_uri(uri);
-
         if(fetched_metadata != NULL)
         {
                 if(parse_metadata( handle,fetched_metadata))