[banshee] LastfmRequest: Fix crash after response timeout (bgo#684792)



commit 830fe4c097dfbe88c91d00ddebbb701baf4033bf
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sat Sep 29 16:57:34 2012 +0200

    LastfmRequest: Fix crash after response timeout (bgo#684792)

 src/Libraries/Lastfm/Lastfm/LastfmRequest.cs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs b/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
index dd20bff..cad5b80 100644
--- a/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
+++ b/src/Libraries/Lastfm/Lastfm/LastfmRequest.cs
@@ -159,6 +159,10 @@ namespace Lastfm
 
             SetResponseString ();
 
+            if (response_string == null) {
+                return StationError.Unknown;
+            }
+
             if (response_string.Contains ("<lfm status=\"failed\">")) {
                 // XML reply indicates an error
                 Match match = Regex.Match (response_string, "<error code=\"(\\d+)\">");
@@ -253,7 +257,7 @@ namespace Lastfm
 
         private void SetResponseString ()
         {
-            if (response_string == null) {
+            if (response_string == null && response_stream != null) {
                 using (StreamReader sr = new StreamReader (response_stream)) {
                     response_string = sr.ReadToEnd ();
                 }



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