1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-27 17:08:00 +01:00

null checks around Application.Current for SyncService.

This commit is contained in:
Kyle Spearrin 2016-10-29 10:30:03 -04:00
parent 74972336c6
commit 428e35237f

View File

@ -54,8 +54,8 @@ namespace Bit.App.Services
{
SyncCompleted(false);
if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized)
if(Application.Current != null && (cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized))
{
MessagingCenter.Send(Application.Current, "Logout", (string)null);
}
@ -141,8 +141,8 @@ namespace Bit.App.Services
{
SyncCompleted(false);
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
{
MessagingCenter.Send(Application.Current, "Logout", (string)null);
}
@ -200,8 +200,8 @@ namespace Bit.App.Services
{
SyncCompleted(false);
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
{
MessagingCenter.Send(Application.Current, "Logout", (string)null);
}
@ -328,12 +328,22 @@ namespace Bit.App.Services
private void SyncStarted()
{
if(Application.Current == null)
{
return;
}
SyncInProgress = true;
MessagingCenter.Send(Application.Current, "SyncStarted");
}
private void SyncCompleted(bool successfully)
{
if(Application.Current == null)
{
return;
}
SyncInProgress = false;
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
}