Resolve crash on empty days in previous code

This commit is contained in:
Mark Watkins 2013-10-12 17:46:06 +10:00
parent 16d924bf6c
commit 4b0a40a825

View File

@ -1323,15 +1323,18 @@ void Daily::Load(QDate date)
QVector<Session *>::iterator i;
// WebView trashes it without asking.. :(
sessbar=new SessionBar(this);
sessbar->setMouseTracking(true);
connect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*)));
int c=0;
for (i=cpap->begin();i!=cpap->end();++i) {
Session * s=*i;
sessbar->add(s, cols[c % maxcolors]);
c++;
}
if (cpap) {
sessbar=new SessionBar(this);
sessbar->setMouseTracking(true);
connect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*)));
int c=0;
for (i=cpap->begin();i!=cpap->end();++i) {
Session * s=*i;
sessbar->add(s, cols[c % maxcolors]);
c++;
}
} else sessbar=NULL;
//sessbar->update();
webView->setHtml(html);