diff --git a/examples/HomeBudget/HomeBudget.cpp b/examples/HomeBudget/HomeBudget.cpp index a7455e504..14657aa93 100644 --- a/examples/HomeBudget/HomeBudget.cpp +++ b/examples/HomeBudget/HomeBudget.cpp @@ -295,15 +295,14 @@ void HomeBudget::RemoveGroup() if(categories.IsEmpty()) { SQL & Delete(GROUPS).Where(ID == groups(ID)); + if(groups.GetCount() == 1) + categories.Disable(); } else { PromptOK(t_("You can't remove this group. It is not empty.")); groups.CancelRemove(); } - - if(groups.GetCount() == 1) - categories.Disable(); } struct AddNewCat : WithNewCategoryLayout @@ -745,6 +744,9 @@ void HomeBudget::SetRest(StaticText &rest, float r) void HomeBudget::UpdateValue() { + if(money.IsEmpty()) + return; + try { SQL & Select(DEFVALUE).From(CATEGORIES).Where(ID == money.Get(CAT_ID));