1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +01:00

handle some crash cases

This commit is contained in:
Kyle Spearrin 2017-05-20 11:29:20 -04:00
parent 05d6f5d806
commit 3415be4c56
3 changed files with 12 additions and 6 deletions

View File

@ -122,8 +122,8 @@ namespace Bit.Android
root.Dispose();
e.Dispose();
}
// Some unknown condition is causing NullReferenceException's in production. Suppress it for now.
catch(NullReferenceException) { }
// Suppress exceptions so that service doesn't crash
catch { }
}
public override void OnInterrupt()

View File

@ -15,13 +15,13 @@ namespace Bit.App.Repositories
public Task<IEnumerable<LoginData>> GetAllByUserIdAsync(string userId)
{
var logins = Connection.Table<LoginData>().Where(f => f.UserId == userId).Cast<LoginData>();
var logins = Connection.Table<LoginData>().Where(l => l.UserId == userId).Cast<LoginData>();
return Task.FromResult(logins);
}
public Task<IEnumerable<LoginData>> GetAllByUserIdAsync(string userId, bool favorite)
{
var logins = Connection.Table<LoginData>().Where(f => f.UserId == userId && f.Favorite == favorite)
var logins = Connection.Table<LoginData>().Where(l => l.UserId == userId && l.Favorite == favorite)
.Cast<LoginData>();
return Task.FromResult(logins);
}

View File

@ -304,7 +304,10 @@ namespace Bit.App.Services
return;
}
var localFolders = (await _folderRepository.GetAllByUserIdAsync(_authService.UserId).ConfigureAwait(false))
var localFolders = (await _folderRepository.GetAllByUserIdAsync(_authService.UserId)
.ConfigureAwait(false))
.GroupBy(f => f.Id)
.Select(f => f.First())
.ToDictionary(f => f.Id);
foreach(var serverFolder in serverFolders)
@ -339,7 +342,10 @@ namespace Bit.App.Services
return;
}
var localLogins = (await _loginRepository.GetAllByUserIdAsync(_authService.UserId).ConfigureAwait(false))
var localLogins = (await _loginRepository.GetAllByUserIdAsync(_authService.UserId)
.ConfigureAwait(false))
.GroupBy(s => s.Id)
.Select(s => s.First())
.ToDictionary(s => s.Id);
foreach(var serverLogin in serverLogins)