diff --git a/include/date.cpp b/include/date.cpp index 0950f6801..754c53f78 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -191,8 +191,16 @@ int TDate::wday() const return ((d + 2*m + 3*(m+1)/5 + y + y/4 - y/100 + y/400) % 7) + 1; // Pure magic } -void TDate::set_day(int n) { _val = makedata(n, month(), year()); } -void TDate::set_month(int n) { _val = makedata(day(), n, year()); } +void TDate::set_day(int n) +{ + CHECK(n > 0 && n < 32, "TDate::set_day: giorno insensato"); + _val = makedata(n, month(), year()); +} +void TDate::set_month(int n) +{ + CHECK(n > 0 && n < 13, "TDate::set_month: mese impossibile"); + _val = makedata(day(), n, year()); +} void TDate::set_year(int n) { _val = makedata(day(), month(), n); } TDate::operator const char*() const diff --git a/include/msksheet.cpp b/include/msksheet.cpp index fdefd5cf3..c873c591a 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -1335,7 +1335,8 @@ void TSpreadsheet::on_idle() { if (_needs_update >= 0) { - update_rec(_needs_update); + if (_needs_update < items()) + update_rec(_needs_update); _needs_update = -1; } }