1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

null checks when error handling

This commit is contained in:
Kyle Spearrin 2017-02-07 21:56:28 -05:00
parent 8a525aee8a
commit e71adbd26d

View File

@ -191,9 +191,11 @@ namespace Bit.App.Repositories
var statusCode = (int)response.StatusCode;
if(statusCode >= 400 && statusCode <= 500)
{
var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
ErrorResponse errorResponseModel = null;
var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
if(!string.IsNullOrWhiteSpace(responseContent))
{
var errorResponse = JObject.Parse(responseContent);
if(errorResponse["ErrorModel"] != null && errorResponse["ErrorModel"]["Message"] != null)
{
@ -203,6 +205,7 @@ namespace Bit.App.Repositories
{
errorResponseModel = errorResponse.ToObject<ErrorResponse>();
}
}
if(errorResponseModel != null)
{