summaryrefslogtreecommitdiffhomepage
path: root/tracker-easy/point-extractor.cpp
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-05-19 16:31:08 +0200
committerStéphane Lenclud <github@lenclud.com>2019-05-19 16:31:38 +0200
commit1579a97c480578dcd14691cd3e40f56fd508204e (patch)
tree4eac0cff9eda3e07e13377f647b0cd915cae2480 /tracker-easy/point-extractor.cpp
parent48b80fb28b9e6e44267c9d1edb8a9968ff81fea5 (diff)
Easy Tracker: Fix #945 trivial warnings.
Also fixing broken build.
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);
+ }
+
}
}