mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 02:14:31 +02:00
Fix exception with AmountFormatter if Si prefix were enabled and no unit symbol were set.
Also this case is now prevented by Validator (as it is not very useful). Fixes issue #171.
This commit is contained in:
parent
430c9fed67
commit
8338c0f2d6
4 changed files with 94 additions and 86 deletions
|
@ -131,7 +131,8 @@ class AmountFormatter
|
|||
/** @var MeasurementUnit $unit */
|
||||
$unit = $options['measurement_unit'];
|
||||
|
||||
return $unit->getUnit();
|
||||
//When no unit is set, return empty string so that this can be formatted properly
|
||||
return $unit->getUnit() ?? '';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue