[PATCH 2/4] profilepgrahics.cpp: fix preceding limit check
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Dec 11 05:26:48 UTC 2013
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
ProfileGraphicsView::plot_depth_profile():
The iterator limit check (i < 7) should precede the indexing
(increments[i]).
Reported by the program cppcheck.
Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
qt-ui/profilegraphics.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 18e97da..19fe81d 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -1098,7 +1098,7 @@ void ProfileGraphicsView::plot_depth_profile()
* we double the interval if this still doesn't get us to 12 or fewer
* time markers */
i = 0;
- while (maxtime / increments[i] > 12 && i < 7)
+ while (i < 7 && maxtime / increments[i] > 12)
i++;
incr = increments[i];
while (maxtime / incr > 12)
--
1.7.11.msysgit.0
More information about the subsurface
mailing list