[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdiagram] src/KChart/Polar: Handle empty models in PieDiagram::valueTotals()
From: Friedrich W. H. Kossebau <kossebau () kde ! org>
Date: 2015-10-31 22:44:13
Message-ID: E1Zsesf-0007Lc-Cp () scm ! kde ! org
[Download RAW message or body]
Git commit 8d3b592447c8f2d8b97beb71287d4c77d63155f9 by Friedrich W. H. Kossebau.
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/KChartPieDiagram.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 = columnCount();
qreal total = 0.0;
- Q_ASSERT( model()->rowCount() >= 1 );
+ // non-empty models need a row with data
+ Q_ASSERT( colCount == 0 || model()->rowCount() >= 1 );
for ( int j = 0; j < colCount; ++j ) {
total += qAbs(model()->data( model()->index( 0, j, rootIndex() ) ).toReal()); // checked
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic