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

null checks on appearing

This commit is contained in:
Kyle Spearrin 2017-12-21 11:05:14 -05:00
parent 713796a4f7
commit 379a82972a

View File

@ -643,9 +643,9 @@ namespace Bit.App.Pages
AlertNoConnection(); AlertNoConnection();
} }
NameCell.InitEvents(); NameCell?.InitEvents();
NotesCell.InitEvents(); NotesCell?.InitEvents();
FolderCell.InitEvents(); FolderCell?.InitEvents();
if(AttachmentsCell != null) if(AttachmentsCell != null)
{ {
@ -655,49 +655,58 @@ namespace Bit.App.Pages
{ {
CustomFieldsCell.Tapped += CustomFieldsCell_Tapped; CustomFieldsCell.Tapped += CustomFieldsCell_Tapped;
} }
DeleteCell.Tapped += DeleteCell_Tapped; if(DeleteCell != null)
{
DeleteCell.Tapped += DeleteCell_Tapped;
}
switch(Cipher.Type) switch(Cipher.Type)
{ {
case CipherType.Login: case CipherType.Login:
LoginPasswordCell.InitEvents(); LoginPasswordCell?.InitEvents();
LoginUsernameCell.InitEvents(); LoginUsernameCell?.InitEvents();
LoginUriCell.InitEvents(); LoginUriCell?.InitEvents();
LoginTotpCell.InitEvents(); LoginTotpCell?.InitEvents();
LoginPasswordCell.Button.Clicked += PasswordButton_Clicked; if(LoginPasswordCell?.Button != null)
LoginGenerateCell.Tapped += GenerateCell_Tapped; {
LoginPasswordCell.Button.Clicked += PasswordButton_Clicked;
}
if(LoginGenerateCell != null)
{
LoginGenerateCell.Tapped += GenerateCell_Tapped;
}
if(LoginTotpCell?.Button != null) if(LoginTotpCell?.Button != null)
{ {
LoginTotpCell.Button.Clicked += TotpButton_Clicked; LoginTotpCell.Button.Clicked += TotpButton_Clicked;
} }
break; break;
case CipherType.Card: case CipherType.Card:
CardBrandCell.InitEvents(); CardBrandCell?.InitEvents();
CardCodeCell.InitEvents(); CardCodeCell?.InitEvents();
CardExpMonthCell.InitEvents(); CardExpMonthCell?.InitEvents();
CardExpYearCell.InitEvents(); CardExpYearCell?.InitEvents();
CardNameCell.InitEvents(); CardNameCell?.InitEvents();
CardNumberCell.InitEvents(); CardNumberCell?.InitEvents();
break; break;
case CipherType.Identity: case CipherType.Identity:
IdTitleCell.InitEvents(); IdTitleCell?.InitEvents();
IdFirstNameCell.InitEvents(); IdFirstNameCell?.InitEvents();
IdMiddleNameCell.InitEvents(); IdMiddleNameCell?.InitEvents();
IdLastNameCell.InitEvents(); IdLastNameCell?.InitEvents();
IdUsernameCell.InitEvents(); IdUsernameCell?.InitEvents();
IdCompanyCell.InitEvents(); IdCompanyCell?.InitEvents();
IdSsnCell.InitEvents(); IdSsnCell?.InitEvents();
IdPassportNumberCell.InitEvents(); IdPassportNumberCell?.InitEvents();
IdLicenseNumberCell.InitEvents(); IdLicenseNumberCell?.InitEvents();
IdEmailCell.InitEvents(); IdEmailCell?.InitEvents();
IdPhoneCell.InitEvents(); IdPhoneCell?.InitEvents();
IdAddress1Cell.InitEvents(); IdAddress1Cell?.InitEvents();
IdAddress2Cell.InitEvents(); IdAddress2Cell?.InitEvents();
IdAddress3Cell.InitEvents(); IdAddress3Cell?.InitEvents();
IdCityCell.InitEvents(); IdCityCell?.InitEvents();
IdStateCell.InitEvents(); IdStateCell?.InitEvents();
IdPostalCodeCell.InitEvents(); IdPostalCodeCell?.InitEvents();
IdCountryCell.InitEvents(); IdCountryCell?.InitEvents();
break; break;
default: default:
break; break;
@ -708,9 +717,9 @@ namespace Bit.App.Pages
{ {
base.OnDisappearing(); base.OnDisappearing();
NameCell.Dispose(); NameCell?.Dispose();
NotesCell.Dispose(); NotesCell?.Dispose();
FolderCell.Dispose(); FolderCell?.Dispose();
if(AttachmentsCell != null) if(AttachmentsCell != null)
{ {
@ -720,49 +729,58 @@ namespace Bit.App.Pages
{ {
CustomFieldsCell.Tapped -= CustomFieldsCell_Tapped; CustomFieldsCell.Tapped -= CustomFieldsCell_Tapped;
} }
DeleteCell.Tapped -= DeleteCell_Tapped; if(DeleteCell != null)
{
DeleteCell.Tapped -= DeleteCell_Tapped;
}
switch(Cipher.Type) switch(Cipher.Type)
{ {
case CipherType.Login: case CipherType.Login:
LoginTotpCell.Dispose(); LoginTotpCell?.Dispose();
LoginPasswordCell.Dispose(); LoginPasswordCell?.Dispose();
LoginUsernameCell.Dispose(); LoginUsernameCell?.Dispose();
LoginUriCell.Dispose(); LoginUriCell?.Dispose();
LoginPasswordCell.Button.Clicked -= PasswordButton_Clicked; if(LoginPasswordCell?.Button != null)
LoginGenerateCell.Tapped -= GenerateCell_Tapped; {
LoginPasswordCell.Button.Clicked -= PasswordButton_Clicked;
}
if(LoginGenerateCell != null)
{
LoginGenerateCell.Tapped -= GenerateCell_Tapped;
}
if(LoginTotpCell?.Button != null) if(LoginTotpCell?.Button != null)
{ {
LoginTotpCell.Button.Clicked -= TotpButton_Clicked; LoginTotpCell.Button.Clicked -= TotpButton_Clicked;
} }
break; break;
case CipherType.Card: case CipherType.Card:
CardBrandCell.Dispose(); CardBrandCell?.Dispose();
CardCodeCell.Dispose(); CardCodeCell?.Dispose();
CardExpMonthCell.Dispose(); CardExpMonthCell?.Dispose();
CardExpYearCell.Dispose(); CardExpYearCell?.Dispose();
CardNameCell.Dispose(); CardNameCell?.Dispose();
CardNumberCell.Dispose(); CardNumberCell?.Dispose();
break; break;
case CipherType.Identity: case CipherType.Identity:
IdTitleCell.Dispose(); IdTitleCell?.Dispose();
IdFirstNameCell.Dispose(); IdFirstNameCell?.Dispose();
IdMiddleNameCell.Dispose(); IdMiddleNameCell?.Dispose();
IdLastNameCell.Dispose(); IdLastNameCell?.Dispose();
IdUsernameCell.Dispose(); IdUsernameCell?.Dispose();
IdCompanyCell.Dispose(); IdCompanyCell?.Dispose();
IdSsnCell.Dispose(); IdSsnCell?.Dispose();
IdPassportNumberCell.Dispose(); IdPassportNumberCell?.Dispose();
IdLicenseNumberCell.Dispose(); IdLicenseNumberCell?.Dispose();
IdEmailCell.Dispose(); IdEmailCell?.Dispose();
IdPhoneCell.Dispose(); IdPhoneCell?.Dispose();
IdAddress1Cell.Dispose(); IdAddress1Cell?.Dispose();
IdAddress2Cell.Dispose(); IdAddress2Cell?.Dispose();
IdAddress3Cell.Dispose(); IdAddress3Cell?.Dispose();
IdCityCell.Dispose(); IdCityCell?.Dispose();
IdStateCell.Dispose(); IdStateCell?.Dispose();
IdPostalCodeCell.Dispose(); IdPostalCodeCell?.Dispose();
IdCountryCell.Dispose(); IdCountryCell?.Dispose();
break; break;
default: default:
break; break;