From kde-commits Sat Oct 31 22:44:13 2015 From: Friedrich W. H. Kossebau Date: Sat, 31 Oct 2015 22:44:13 +0000 To: kde-commits Subject: [kdiagram] src/KChart/Polar: Handle empty models in PieDiagram::valueTotals() Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=144633146332637 Git commit 8d3b592447c8f2d8b97beb71287d4c77d63155f9 by Friedrich W. H. Koss= ebau. Committed on 31/10/2015 at 22:41. Pushed by kossebau into branch 'master'. Handle empty models in PieDiagram::valueTotals() M +2 -1 src/KChart/Polar/KChartPieDiagram.cpp http://commits.kde.org/kdiagram/8d3b592447c8f2d8b97beb71287d4c77d63155f9 diff --git a/src/KChart/Polar/KChartPieDiagram.cpp b/src/KChart/Polar/KChar= tPieDiagram.cpp index fea9ae4..f9d0946 100644 --- a/src/KChart/Polar/KChartPieDiagram.cpp +++ b/src/KChart/Polar/KChartPieDiagram.cpp @@ -945,7 +945,8 @@ qreal PieDiagram::valueTotals() const return 0; const int colCount =3D columnCount(); qreal total =3D 0.0; - Q_ASSERT( model()->rowCount() >=3D 1 ); + // non-empty models need a row with data + Q_ASSERT( colCount =3D=3D 0 || model()->rowCount() >=3D 1 ); for ( int j =3D 0; j < colCount; ++j ) { total +=3D qAbs(model()->data( model()->index( 0, j, rootIndex() ) )= .toReal()); // checked }