mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-05 21:22:39 +02:00
(math) Reduce log error spam from null unit conversions
This commit is contained in:
@@ -49,13 +49,14 @@ public class Units {
|
||||
var fromUnit = unitsByName.get(fromUnitName.toLowerCase());
|
||||
var toUnit = unitsByName.get(toUnitName.toLowerCase());
|
||||
|
||||
if (Objects.equals(fromUnit, toUnit)) {
|
||||
return Optional.of(value + " " + fromUnit.name);
|
||||
}
|
||||
if (null == fromUnit || null == toUnit) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
if (Objects.equals(fromUnit, toUnit)) {
|
||||
return Optional.of(value + " " + fromUnit.name);
|
||||
}
|
||||
|
||||
if (!Objects.equals(toUnit.type, fromUnit.type)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
Reference in New Issue
Block a user