summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-10-04 16:41:17 -0700
committerAndrew <andrewarnott@gmail.com>2008-10-04 16:41:17 -0700
commitd89b47ef7d65ec863e8858e4cc52024c77092915 (patch)
tree4b1e1f7daed3fe7c44f0cde2ea3999c37e7f968b
parente414945b440325d6616c57e3baa5c818821f558a (diff)
downloadDotNetOpenAuth-d89b47ef7d65ec863e8858e4cc52024c77092915.zip
DotNetOpenAuth-d89b47ef7d65ec863e8858e4cc52024c77092915.tar.gz
DotNetOpenAuth-d89b47ef7d65ec863e8858e4cc52024c77092915.tar.bz2
Fixed NullReferenceException thrown sometimes from StandardWebRequestHandler.
-rw-r--r--src/DotNetOAuth/ChannelElements/StandardWebRequestHandler.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/DotNetOAuth/ChannelElements/StandardWebRequestHandler.cs b/src/DotNetOAuth/ChannelElements/StandardWebRequestHandler.cs
index 78a2fae..fa91990 100644
--- a/src/DotNetOAuth/ChannelElements/StandardWebRequestHandler.cs
+++ b/src/DotNetOAuth/ChannelElements/StandardWebRequestHandler.cs
@@ -53,8 +53,12 @@ namespace DotNetOAuth.ChannelElements {
}
} catch (WebException ex) {
if (Logger.IsErrorEnabled) {
- using (var reader = new StreamReader(ex.Response.GetResponseStream())) {
- Logger.ErrorFormat("WebException from {0}: {1}", ex.Response.ResponseUri, reader.ReadToEnd());
+ if (ex.Response != null) {
+ using (var reader = new StreamReader(ex.Response.GetResponseStream())) {
+ Logger.ErrorFormat("WebException from {0}: {1}", ex.Response.ResponseUri, reader.ReadToEnd());
+ }
+ } else {
+ Logger.ErrorFormat("WebException {1} from {0}, no response available.", request.RequestUri, ex.Status);
}
}
throw new ProtocolException(MessagingStrings.ErrorInRequestReplyMessage, ex);