capuchin r83 - in trunk: . src/libcapuchin/Downloaders



Author: sebp
Date: Wed Apr  2 20:38:28 2008
New Revision: 83
URL: http://svn.gnome.org/viewvc/capuchin?rev=83&view=rev

Log:
Fixed null pointer exception when Content-Disposition isn't available


Modified:
   trunk/ChangeLog
   trunk/src/libcapuchin/Downloaders/HttpDownloader.cs

Modified: trunk/src/libcapuchin/Downloaders/HttpDownloader.cs
==============================================================================
--- trunk/src/libcapuchin/Downloaders/HttpDownloader.cs	(original)
+++ trunk/src/libcapuchin/Downloaders/HttpDownloader.cs	Wed Apr  2 20:38:28 2008
@@ -33,9 +33,9 @@
                 // Open the URL for download
                 strResponse = webResponse.GetResponseStream();
 				
-				string disposition = webResponse.Headers.Get ("Content-Disposition").ToLower();
+				string disposition = webResponse.Headers.Get ("Content-Disposition");
 				string localFile;
-				if (disposition.StartsWith ("attachment"))
+				if (disposition != null && disposition.ToLower().StartsWith ("attachment"))
 				{
 					// Looks like: Content-Disposition: attachment; filename=genome.jpeg;
 					string filename = disposition.Split (';')[1].Split('=')[1].Replace("\"", "");



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