diff --git a/include/opendht/indexation/pht.h b/include/opendht/indexation/pht.h
index 4e1d667ab2c7f33348e39956b4e0c858b1897fb0..2e687cbac6daa6181fde53f7ae41c8aee101fd13 100644
--- a/include/opendht/indexation/pht.h
+++ b/include/opendht/indexation/pht.h
@@ -87,7 +87,7 @@ struct Prefix {
         auto longest_prefix_size = std::min(p1.size_, p2.size_);
 
         for (i = 0; i < longest_prefix_size; i++) {
-            if (p1.content_.data()[i] != p2.content_.data()[i] || i == longest_prefix_size)
+            if (p1.content_.data()[i] != p2.content_.data()[i])
                 break;
         }