From ee2c657d8c2d433795598d577d87ccbaabd2cc7e Mon Sep 17 00:00:00 2001 From: unodgs Date: Tue, 12 Oct 2010 19:34:09 +0000 Subject: [PATCH] HomeBudget: Fixed crash in category update, fixed disabling category grid when delete last group (thanks porto and mr_ped!) git-svn-id: svn://ultimatepp.org/upp/trunk@2771 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- examples/HomeBudget/HomeBudget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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));