summaryrefslogtreecommitdiff
blob: 732cde2d7a67a1fcc00afdfbeebd30c4c2ed3238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git plasma-emergelog.cpp plasma-emergelog.cpp
index 362eaa3..f3e8ea8 100644
--- old/plasma-emergelog-0.0.2/plasma-emergelog.cpp
+++ new/plasma-emergelog-0.0.2/plasma-emergelog.cpp
@@ -35,6 +35,7 @@
 #include "plasma-emergelog-painter.h"
 #include <exception>
 #include <iostream>
+#include <cmath>
 
 
 class myexception: public std::exception
@@ -167,7 +168,7 @@ void emergelog::process_data(){
 		/* Create a list . Each element is a line from that file */
 		list = data.split('\n', QString::SkipEmptyParts);
 		/* read the block BACKWARDS */
-		for (int i=list.size()-1;i>(list.size()-(document->maximumBlockCount()));i--){
+		for (int i=list.size()-1;i>std::max<int>(0, list.size()-(document->maximumBlockCount()));i--){
 			if(cursor.position() != 0){
 				cursor.insertBlock();
 			}