Commit 4d1964590e0372cf69cbea6f3a649b9572b10ad2

Authored by Scott Klum
1 parent c773e100

Check that template contains at least the indices specified by from and to

Showing 1 changed file with 3 additions and 1 deletions
openbr/plugins/template.cpp
1 1 #include <QtCore>
2 2  
3 3 #include "openbr_internal.h"
  4 +#include "openbr/core/common.h"
4 5  
5 6 namespace br
6 7 {
... ... @@ -229,7 +230,8 @@ class ReorderPointsTransform : public UntrainableMetadataTransform
229 230 {
230 231 if (from.size() == to.size()) {
231 232 QList<QPointF> points = src.points();
232   - if (!points.contains(QPointF(-1,-1))) {
  233 + int size = src.points().size();
  234 + if (!points.contains(QPointF(-1,-1)) && Common::Max(from) < size && Common::Max(to) < size) {
233 235 for (int i=0; i<from.size(); i++) {
234 236 std::swap(points[from[i]],points[to[i]]);
235 237 }
... ...