diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2020-10-05 17:34:28 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2020-10-05 17:38:13 +0300 |
commit | 0d991d571266a322f01898c133a771ebd290b8d4 (patch) | |
tree | b30a2556692b7c00df6fd1996368356cabfb23a0 /Duplicati/Library/Backend/Sia | |
parent | 71edf641a5c94eaa2ca2ca09dcf5a9283f3df8bd (diff) |
Refine check for null web exception response.
Diffstat (limited to 'Duplicati/Library/Backend/Sia')
-rw-r--r-- | Duplicati/Library/Backend/Sia/Sia.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Duplicati/Library/Backend/Sia/Sia.cs b/Duplicati/Library/Backend/Sia/Sia.cs index 62db58a37..a9c0f1030 100644 --- a/Duplicati/Library/Backend/Sia/Sia.cs +++ b/Duplicati/Library/Backend/Sia/Sia.cs @@ -83,13 +83,13 @@ namespace Duplicati.Library.Backend.Sia private string getResponseBodyOnError(string context, System.Net.WebException wex) { - if (wex.Response is null) + HttpWebResponse response = wex.Response as HttpWebResponse; + if (response is null) { return $"{context} failed with error: {wex.Message}"; } string body = ""; - System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)wex.Response; using (System.IO.Stream data = response.GetResponseStream()) using (var reader = new System.IO.StreamReader(data)) { |