fix(client/ui): silently fail ingredient input if any is null

This commit is contained in:
Zhongheng Liu 2026-01-09 14:09:15 +01:00
commit e5259c8253

View file

@ -75,6 +75,10 @@ public class IngredientListCell extends OrderedEditableListCell<RecipeIngredient
String name = nameInput.getText();
if (unit == null || !unit.isFormal()) {
String desc = amountInput.getText();
if (desc.isEmpty() || name.isEmpty()) {
// TODO printError() integration
return; // The user is forced to kindly try again until something valid comes up.
}
Ingredient newIngredient = new Ingredient(name, 0., 0., 0.);
commitEdit(new VagueIngredient(newIngredient, desc));
return;