[banshee] LastFm: Null check for scrobble parameters (bgo#685920)



commit ffa30cafc17e35d59c136c4b811abb96249e50da
Author: Phil Trimble <PhilTrimble gmail com>
Date:   Mon Nov 26 02:08:30 2012 +0000

    LastFm: Null check for scrobble parameters (bgo#685920)
    
    As noted in bgo#685920 an exception was being thrown attempting to escape
    a null scrobble parameter when building Post data. This was preventing
    scrobbles from being submitted. This is a regression in version 2.6.0 due
    to the new way we build the submissions for the Last.FM 2.0 API.
    
    We will now perform a null check on each parameter and only attempt to
    escape it if the value is not null.
    
    Signed-off-by: Andres G. Aragoneses <knocte gmail com>

 src/Libraries/Lastfm/Lastfm/LastfmRequest.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs b/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
index cad5b80..4b241af 100644
--- a/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
+++ b/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
@@ -212,9 +212,12 @@ namespace Lastfm
             StringBuilder data = new StringBuilder ();
             data.AppendFormat ("method={0}", method);
             data.AppendFormat ("&api_key={0}", LastfmCore.ApiKey);
+
             foreach (KeyValuePair<string, string> param in parameters) {
-                data.AppendFormat ("&{0}={1}", param.Key, Uri.EscapeDataString (param.Value));
+                data.AppendFormat ("&{0}={1}",
+                                   param.Key, param.Value != null ? Uri.EscapeDataString (param.Value) : null);
             }
+
             data.AppendFormat ("&api_sig={0}", GetSignature ());
 
             return data.ToString ();



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