fix potenital crash with invalid template entry

This commit is contained in:
Philipp Crocoll
2017-07-10 12:39:48 +02:00
parent c82fc7d772
commit 520b78e47a

View File

@@ -48,11 +48,14 @@ namespace keepass2android
{
if (entry.Strings.Exists(EtmTemplateUuid))
{
PwUuid templateUuid = new PwUuid(MemUtil.HexStringToByteArray(entry.Strings.ReadSafe(EtmTemplateUuid)));
return db.Entries.ContainsKey(templateUuid);
byte[] uuidBytes = MemUtil.HexStringToByteArray(entry.Strings.ReadSafe(EtmTemplateUuid));
if (uuidBytes != null)
{
PwUuid templateUuid = new PwUuid(uuidBytes);
return db.Entries.ContainsKey(templateUuid);
}
}
else
return false;
return false;
}
public KpEntryTemplatedEdit(Database db, PwEntry entry)