summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy/point-extractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-easy/point-extractor.cpp')
-rw-r--r--tracker-easy/point-extractor.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tracker-easy/point-extractor.cpp b/tracker-easy/point-extractor.cpp
index 4b54fd25..34d93b52 100644
--- a/tracker-easy/point-extractor.cpp
+++ b/tracker-easy/point-extractor.cpp
@@ -143,7 +143,7 @@ namespace EasyTracker
while (aPoints.size() > aNeededPointCount) // Until we have no more than three points
{
int maxY = 0;
- unsigned index = (unsigned)-1;
+ size_t index = std::numeric_limits<size_t>::max();
// Search for the point with highest Y coordinate
for (size_t i = 0; i < aPoints.size(); i++)
@@ -154,9 +154,13 @@ namespace EasyTracker
index = i;
}
}
-
- // Discard it
- aPoints.erase(aPoints.begin() + index);
+
+ if (index < aPoints.size()) // Defensive
+ {
+ // Discard it
+ aPoints.erase(aPoints.begin() + index);
+ }
+
}
}