Merge branch 'bugfix/null-amount-name' into 'main'
fix(client/ui): silently fail ingredient input if any is null Closes #50 See merge request cse1105/2025-2026/teams/csep-team-76!45
This commit is contained in:
commit
cd62192ddc
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue