From e3ac11e52b82db9c69c0bad13f60ca0998e5ecdd Mon Sep 17 00:00:00 2001 From: JustCameToHelp Date: Sun, 29 Jan 2017 13:40:13 +0100 Subject: [PATCH] Corrected reporting of array indices violating uniqueItems constraint. --- include/valijson/validation_visitor.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/valijson/validation_visitor.hpp b/include/valijson/validation_visitor.hpp index ba9756d..1b9c493 100644 --- a/include/valijson/validation_visitor.hpp +++ b/include/valijson/validation_visitor.hpp @@ -1052,8 +1052,9 @@ public: bool validated = true; const typename AdapterType::Array::const_iterator secondLast = --targetArray.end(); unsigned int outerIndex = 0; - for (typename AdapterType::Array::const_iterator outerItr = targetArray.begin(); outerItr != secondLast; ++outerItr) { - unsigned int innerIndex = 1; + typename AdapterType::Array::const_iterator outerItr = targetArray.begin(); + for (; outerItr != secondLast; ++outerItr) { + unsigned int innerIndex = outerIndex + 1; typename AdapterType::Array::const_iterator innerItr(outerItr); for (++innerItr; innerItr != end; ++innerItr) { if (outerItr->equalTo(*innerItr, true)) {