Fix a bug : in month stats segfault

This commit is contained in:
Grégory Soutadé 2012-03-11 17:54:42 +01:00
parent d0d0304ce4
commit e4ec79b9df

View File

@ -253,20 +253,18 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT
_plot->setDataset(0, vec, ""); _plot->setDataset(0, vec, "");
vec.clear(); i=0;
for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); for (account = 0, i = 0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end();
account++, accountIt++, i++) account++, accountIt++, i++)
{ {
if (_account->item(account)->checkState() != Qt::Checked) if (_account->item(account)->checkState() != Qt::Checked)
{
i-- ;
continue; continue;
}
for (a=0; a<nbDays; a++) vec.clear();
for (a=0; a<nbDays; a++)
vec << operations[accountIt->id][a]; vec << operations[accountIt->id][a];
_plot->setDataset(i+1, vec, user->GetAccountName(accountIt->id)); _plot->setDataset(++i, vec, user->GetAccountName(accountIt->id));
} }
} }
else else
@ -355,7 +353,6 @@ void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearT
legend->setTitleText(_("Accounts")); legend->setTitleText(_("Accounts"));
legend->setText(0, _("0 line")); legend->setText(0, _("0 line"));
{ {
QVector<QString> vec;
i = 1; i = 1;
for (a=0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); for (a=0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end();
a++, accountIt++) a++, accountIt++)