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

null checks

This commit is contained in:
Kyle Spearrin 2019-06-12 21:49:52 -04:00
parent 028ebff102
commit 0b56dd2795

View File

@ -429,6 +429,10 @@ namespace Bit.Droid.Services
public void Autofill(CipherView cipher) public void Autofill(CipherView cipher)
{ {
var activity = (MainActivity)CrossCurrentActivity.Current.Activity; var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
if(activity == null)
{
return;
}
if(activity.Intent.GetBooleanExtra("autofillFramework", false)) if(activity.Intent.GetBooleanExtra("autofillFramework", false))
{ {
if(cipher == null) if(cipher == null)
@ -447,7 +451,7 @@ namespace Bit.Droid.Services
} }
var parser = new Parser(structure, activity.ApplicationContext); var parser = new Parser(structure, activity.ApplicationContext);
parser.Parse(); parser.Parse();
if(!parser.FieldCollection.Fields.Any() || string.IsNullOrWhiteSpace(parser.Uri)) if((!parser.FieldCollection?.Fields?.Any() ?? true) || string.IsNullOrWhiteSpace(parser.Uri))
{ {
activity.SetResult(Result.Canceled); activity.SetResult(Result.Canceled);
activity.Finish(); activity.Finish();