Fixed a bug that segfaulted on if too few entries
[weightgraph] / weightgraph / weightgraphview.cpp
index a9d93e1..4e0d65f 100644 (file)
@@ -152,7 +152,7 @@ void WeightGraphView::paintEvent(QPaintEvent *)
   }
 
   // Interpolate to fill gap in left part of the graph
-  if (weights.first().date != f && beforeFirst != NULL) {
+  if (weights.size() >= 2 && weights.first().date != f && beforeFirst != NULL) {
     DW dw;
     dw.date = f;
     dw.weight = (weights.first().weight - beforeFirst->weight)