mirror of
https://github.com/bitwarden/android.git
synced 2025-01-12 19:27:37 +03:00
null check all the things (#957)
This commit is contained in:
parent
61495cd428
commit
a4e0535464
1 changed files with 9 additions and 3 deletions
|
@ -203,12 +203,18 @@ namespace Bit.iOS.Autofill
|
||||||
private async Task ProvideCredentialAsync()
|
private async Task ProvideCredentialAsync()
|
||||||
{
|
{
|
||||||
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService", true);
|
var cipherService = ServiceContainer.Resolve<ICipherService>("cipherService", true);
|
||||||
var cipher = await cipherService?.GetAsync(_context.CredentialIdentity.RecordIdentifier);
|
Bit.Core.Models.Domain.Cipher cipher = null;
|
||||||
if (cipher == null || cipher.Type != Bit.Core.Enums.CipherType.Login)
|
var cancel = cipherService == null || _context.CredentialIdentity?.RecordIdentifier == null;
|
||||||
|
if (!cancel)
|
||||||
|
{
|
||||||
|
cipher = await cipherService.GetAsync(_context.CredentialIdentity.RecordIdentifier);
|
||||||
|
cancel = cipher == null || cipher.Type != Bit.Core.Enums.CipherType.Login || cipher.Login == null;
|
||||||
|
}
|
||||||
|
if (cancel)
|
||||||
{
|
{
|
||||||
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
||||||
Convert.ToInt32(ASExtensionErrorCode.CredentialIdentityNotFound), null);
|
Convert.ToInt32(ASExtensionErrorCode.CredentialIdentityNotFound), null);
|
||||||
ExtensionContext.CancelRequest(err);
|
ExtensionContext?.CancelRequest(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue