changeset 3150:062f42c3737e

Fix possible crash in scrobbler plugin
author Tomasz Mon <desowin@gmail.com>
date Tue, 12 May 2009 08:30:43 +0200
parents 4b50e2a0ae1f
children 7b80d4fb493d
files src/scrobbler/configure.c src/scrobbler/scrobbler.c src/scrobbler/settings.h
diffstat 3 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/scrobbler/configure.c	Mon May 11 12:25:48 2009 -0500
+++ b/src/scrobbler/configure.c	Tue May 12 08:30:43 2009 +0200
@@ -19,8 +19,6 @@
 #include "configure.h"
 #include "plugin.h"
 
-#define LASTFM_HS_URL "http://post.audioscrobbler.com"
-
 GtkWidget *entry1, *entry2, *entry3, *ge_entry1, *ge_entry2, *cfgdlg;
 static GdkColor disabled_color;
 guint apply_timeout = 0; /* ID of timeout to save new config */
--- a/src/scrobbler/scrobbler.c	Mon May 11 12:25:48 2009 -0500
+++ b/src/scrobbler/scrobbler.c	Tue May 12 08:30:43 2009 +0200
@@ -1083,7 +1083,10 @@
         sc_challenge_hash = sc_major_error = NULL;
     sc_username = strdup(uname);
     sc_password = strdup(pwd);
-   	sc_hs_url = strdup(url);
+    if (url)
+        sc_hs_url = strdup(url);
+    else
+        sc_hs_url = strdup(LASTFM_HS_URL);
     read_cache();
     pdebug("scrobbler starting up", DEBUG);
 }
--- a/src/scrobbler/settings.h	Mon May 11 12:25:48 2009 -0500
+++ b/src/scrobbler/settings.h	Tue May 12 08:30:43 2009 +0200
@@ -8,5 +8,6 @@
 #define SUB_DEBUG 0
 #define CLIENT "Audacious"
 #define USER_AGENT "AudioScrobbler/1.1" PACKAGE_NAME "/" PACKAGE_VERSION
+#define LASTFM_HS_URL "http://post.audioscrobbler.com"
 
 #endif