Fix segfault on mouseOver at the Profile with an invalid dive selected ( trip )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-05-13 15:28:17 -03:00
parent 605f42daa4
commit 61373eaccf
4 changed files with 16 additions and 7 deletions

View file

@ -214,15 +214,13 @@ void ProfileGraphicsView::plot(struct dive *d)
resetTransform();
zoomLevel = 0;
dive = d;
toolTip = 0;
}
if(!isVisible()){
if(!isVisible() || !dive){
return;
}
if(!dive)
return;
scene()->setSceneRect(0,0, viewport()->width()-50, viewport()->height()-50);
QSettings s;
@ -1278,8 +1276,12 @@ void ToolTipItem::collapse()
void ToolTipItem::expand()
{
QRectF nextRectangle;
if (!title){
return;
}
QRectF nextRectangle;
double width = 0, height = title->boundingRect().height() + SPACING;
Q_FOREACH(ToolTip t, toolTips) {
if (t.second->boundingRect().width() > width)