From 4d1964590e0372cf69cbea6f3a649b9572b10ad2 Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Tue, 27 Jan 2015 15:12:14 -0500 Subject: [PATCH] Check that template contains at least the indices specified by from and to --- openbr/plugins/template.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openbr/plugins/template.cpp b/openbr/plugins/template.cpp index f64046b..447a4f8 100644 --- a/openbr/plugins/template.cpp +++ b/openbr/plugins/template.cpp @@ -1,6 +1,7 @@ #include #include "openbr_internal.h" +#include "openbr/core/common.h" namespace br { @@ -229,7 +230,8 @@ class ReorderPointsTransform : public UntrainableMetadataTransform { if (from.size() == to.size()) { QList points = src.points(); - if (!points.contains(QPointF(-1,-1))) { + int size = src.points().size(); + if (!points.contains(QPointF(-1,-1)) && Common::Max(from) < size && Common::Max(to) < size) { for (int i=0; i