Avoid null reference exception when building Sia error messages.
If the resource does not provide an error response, the Response property will be null. This fixes #4193.
This commit is contained in:
@@ -83,6 +83,11 @@ namespace Duplicati.Library.Backend.Sia
|
||||
|
||||
private string getResponseBodyOnError(string context, System.Net.WebException wex)
|
||||
{
|
||||
if (wex.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())
|
||||
|
||||
Reference in New Issue
Block a user