mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 15:53:44 +00:00
null checking
This commit is contained in:
@@ -440,7 +440,7 @@ namespace Bit.App.Pages
|
|||||||
EditMode ? AppResources.ItemUpdated : AppResources.NewItemCreated);
|
EditMode ? AppResources.ItemUpdated : AppResources.NewItemCreated);
|
||||||
_messagingService.Send(EditMode ? "editedCipher" : "addedCipher", Cipher.Id);
|
_messagingService.Send(EditMode ? "editedCipher" : "addedCipher", Cipher.Id);
|
||||||
|
|
||||||
if((Page as AddEditPage).FromAutofillFramework)
|
if(Page is AddEditPage page && page.FromAutofillFramework)
|
||||||
{
|
{
|
||||||
// Close and go back to app
|
// Close and go back to app
|
||||||
_deviceActionService.CloseAutofill();
|
_deviceActionService.CloseAutofill();
|
||||||
|
|||||||
@@ -123,14 +123,14 @@ namespace Bit.iOS.Core.Controllers
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(PasswordCell.TextField.Text))
|
if(string.IsNullOrWhiteSpace(PasswordCell?.TextField?.Text))
|
||||||
{
|
{
|
||||||
DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
|
DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
|
||||||
AppResources.Password), AppResources.Ok);
|
AppResources.Password), AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(NameCell.TextField.Text))
|
if(string.IsNullOrWhiteSpace(NameCell?.TextField?.Text))
|
||||||
{
|
{
|
||||||
DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
|
DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
|
||||||
AppResources.Name), AppResources.Ok);
|
AppResources.Name), AppResources.Ok);
|
||||||
@@ -139,20 +139,23 @@ namespace Bit.iOS.Core.Controllers
|
|||||||
|
|
||||||
var cipher = new CipherView
|
var cipher = new CipherView
|
||||||
{
|
{
|
||||||
Name = string.IsNullOrWhiteSpace(NameCell.TextField.Text) ? null : NameCell.TextField.Text,
|
Name = NameCell.TextField.Text,
|
||||||
Notes = string.IsNullOrWhiteSpace(NotesCell.TextView.Text) ? null : NotesCell.TextView.Text,
|
Notes = string.IsNullOrWhiteSpace(NotesCell?.TextView?.Text) ? null : NotesCell.TextView.Text,
|
||||||
Favorite = FavoriteCell.Switch.On,
|
Favorite = FavoriteCell.Switch.On,
|
||||||
FolderId = FolderCell.SelectedIndex == 0 ? null : _folders.ElementAtOrDefault(FolderCell.SelectedIndex - 1)?.Id,
|
FolderId = FolderCell.SelectedIndex == 0 ?
|
||||||
|
null : _folders.ElementAtOrDefault(FolderCell.SelectedIndex - 1)?.Id,
|
||||||
Type = Bit.Core.Enums.CipherType.Login,
|
Type = Bit.Core.Enums.CipherType.Login,
|
||||||
Login = new LoginView
|
Login = new LoginView
|
||||||
{
|
{
|
||||||
Uris = null,
|
Uris = null,
|
||||||
Username = string.IsNullOrWhiteSpace(UsernameCell.TextField.Text) ? null : UsernameCell.TextField.Text,
|
Username = string.IsNullOrWhiteSpace(UsernameCell?.TextField?.Text) ?
|
||||||
Password = string.IsNullOrWhiteSpace(PasswordCell.TextField.Text) ? null : PasswordCell.TextField.Text,
|
null : UsernameCell.TextField.Text,
|
||||||
|
Password = string.IsNullOrWhiteSpace(PasswordCell.TextField.Text) ?
|
||||||
|
null : PasswordCell.TextField.Text,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(UriCell.TextField.Text))
|
if(!string.IsNullOrWhiteSpace(UriCell?.TextField?.Text))
|
||||||
{
|
{
|
||||||
cipher.Login.Uris = new List<LoginUriView>
|
cipher.Login.Uris = new List<LoginUriView>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user