From 07286e80ddc3d0e448401a4432dc88d4df7c7387 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Wed, 26 Jul 2023 23:04:29 +0200
Subject: Fix result filtering in identity property lookup

---
 src/identity.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/identity.cpp b/src/identity.cpp
index 3b8d3bf..fc62995 100644
--- a/src/identity.cpp
+++ b/src/identity.cpp
@@ -6,8 +6,6 @@
 #include <set>
 #include <stdexcept>
 
-#include <iostream>
-
 using namespace erebos;
 
 using std::async;
@@ -354,8 +352,8 @@ optional<Stored<IdentityData>> Identity::Priv::lookupProperty(
 	}
 
 	for (auto x = prop_heads.begin(); x != prop_heads.end(); x++)
-		for (auto y = std::next(x); y != prop_heads.end();)
-			if (y->precedes(*x))
+		for (auto y = prop_heads.begin(); y != prop_heads.end();)
+			if (y != x && y->precedes(*x))
 				y = prop_heads.erase(y);
 			else
 				y++;
-- 
cgit v1.2.3