mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
Don't break when CipherType data is null (#1008)
as explained in issue https://github.com/bitwarden/mobile/issues/1006
This commit is contained in:
parent
ff322cd2dd
commit
cf6021d898
1 changed files with 29 additions and 15 deletions
|
@ -2,6 +2,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Bit.Core.Models.Data
|
namespace Bit.Core.Models.Data
|
||||||
{
|
{
|
||||||
|
@ -25,22 +26,35 @@ namespace Bit.Core.Models.Data
|
||||||
Notes = response.Notes;
|
Notes = response.Notes;
|
||||||
CollectionIds = collectionIds?.ToList() ?? response.CollectionIds;
|
CollectionIds = collectionIds?.ToList() ?? response.CollectionIds;
|
||||||
|
|
||||||
switch (Type)
|
try // Added to address Issue (https://github.com/bitwarden/mobile/issues/1006)
|
||||||
{
|
{
|
||||||
case Enums.CipherType.Login:
|
switch (Type)
|
||||||
Login = new LoginData(response.Login);
|
{
|
||||||
break;
|
case Enums.CipherType.Login:
|
||||||
case Enums.CipherType.SecureNote:
|
Login = new LoginData(response.Login);
|
||||||
SecureNote = new SecureNoteData(response.SecureNote);
|
break;
|
||||||
break;
|
case Enums.CipherType.SecureNote:
|
||||||
case Enums.CipherType.Card:
|
SecureNote = new SecureNoteData(response.SecureNote);
|
||||||
Card = new CardData(response.Card);
|
break;
|
||||||
break;
|
case Enums.CipherType.Card:
|
||||||
case Enums.CipherType.Identity:
|
Card = new CardData(response.Card);
|
||||||
Identity = new IdentityData(response.Identity);
|
break;
|
||||||
break;
|
case Enums.CipherType.Identity:
|
||||||
default:
|
Identity = new IdentityData(response.Identity);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
System.Diagnostics.Trace.WriteLine(new StringBuilder()
|
||||||
|
.Append("BitWarden CipherData constructor failed to initialize CyperType '")
|
||||||
|
.Append(Type)
|
||||||
|
.Append("'; id = {")
|
||||||
|
.Append(Id)
|
||||||
|
.AppendLine("}")
|
||||||
|
.ToString(), "BitWarden CipherData constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
Fields = response.Fields?.Select(f => new FieldData(f)).ToList();
|
Fields = response.Fields?.Select(f => new FieldData(f)).ToList();
|
||||||
|
|
Loading…
Reference in a new issue