From 8283f962d98761685b80573d949698a43d801bdb 2015-03-13 13:17:57 From: Friedemann Kleint Date: 2015-03-13 13:17:57 Subject: [PATCH] LineChartItem::updateGeometry(): Catch and warn about unexpected domains. Task-number: QTRD-3507 Change-Id: I60600dceacd689fd61f3d9000d6f8e3ebbea08a1 Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp index 91175b7..7ae49f9 100644 --- a/src/charts/linechart/linechartitem.cpp +++ b/src/charts/linechart/linechartitem.cpp @@ -160,9 +160,14 @@ void LineChartItem::updateGeometry() } bool dummyOk; // We know points are ok, but this is needed - qreal currentAngle = static_cast(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk); - qreal previousAngle = static_cast(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk); - + qreal currentAngle = 0; + qreal previousAngle = 0; + if (const PolarDomain *pd = qobject_cast(domain())) { + currentAngle = pd->toAngularCoordinate(currentSeriesPoint.x(), dummyOk); + previousAngle = pd->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk); + } else { + qWarning() << Q_FUNC_INFO << "Unexpected domain: " << domain(); + } if ((qAbs(currentAngle - previousAngle) > 180.0)) { // If the angle between two points is over 180 degrees (half X range), // any direct segment between them becomes meaningless.