fix creation of IfDevice string, closes #888

This commit is contained in:
Philipp Crocoll
2019-08-19 12:10:27 +02:00
parent 4b56eca5e2
commit 1f20c18ad6

View File

@@ -138,6 +138,8 @@ namespace keepass2android
TrimFields = true
};
bool hasEnabledDevices = devices.Any(kvp => kvp.Value);
string result = "";
foreach (var deviceWithEnabled in devices)
{
@@ -145,6 +147,9 @@ namespace keepass2android
{
result += opt.FieldSeparator;
}
//if the list of devices has enabled devices, we do not need to include a negated expression
if (hasEnabledDevices && !deviceWithEnabled.Value)
continue;
string deviceValue = (deviceWithEnabled.Value ? "" : "!") + deviceWithEnabled.Key;
if (deviceValue.Contains(opt.FieldSeparator) || deviceValue.Contains("\\") ||
deviceValue.Contains("\""))