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 7d7158b121
Signed by: steven
GPG key ID: F69B980899C1C09D

View file

@ -75,6 +75,10 @@ public class IngredientListCell extends OrderedEditableListCell<RecipeIngredient
String name = nameInput.getText(); String name = nameInput.getText();
if (unit == null || !unit.isFormal()) { if (unit == null || !unit.isFormal()) {
String desc = amountInput.getText(); 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.); Ingredient newIngredient = new Ingredient(name, 0., 0., 0.);
commitEdit(new VagueIngredient(newIngredient, desc)); commitEdit(new VagueIngredient(newIngredient, desc));
return; return;