Check for 0 and only apply the value in that case.

See comment at change for more background.
This commit is contained in:
chimp1984 2020-11-04 12:54:35 -05:00
parent c9b3f9d457
commit 5817525776
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3

View file

@ -245,7 +245,16 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
setCryptoCurrencies(prefPayload.getCryptoCurrencies());
setBsqBlockChainExplorer(prefPayload.getBsqBlockChainExplorer());
GlobalSettings.setDefaultTradeCurrency(preferredTradeCurrency);
// If a user has updated and the field was not set and get set to 0 by protobuf
// As there is no way to detect that a primitive value field was set we cannot apply
// a "marker" value like -1 to it. We also do not want to wrap the value in a new
// proto message as thats too much for that feature... So we accept that if the user
// sets the value to 0 it will be overwritten by the default at next startup.
if (prefPayload.getBsqAverageTrimThreshold() == 0) {
prefPayload.setBsqAverageTrimThreshold(0.05);
}
setupPreferences();
}