aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/inet/set.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/lua/inet/set.lua b/lua/inet/set.lua
index effb0f2..27c9388 100644
--- a/lua/inet/set.lua
+++ b/lua/inet/set.lua
@@ -33,11 +33,17 @@ function M.aggregate(t)
if ia then
local ib = ia:flip() -- counterpart
for j=1,n do
- if j ~= i and t[j] == ib then
- -- counterpart found, aggregating
- t[i] = (ia ^ -1):network()
- t[j] = nil
- flag = true
+ if j ~= i then
+ if ia == t[j] then
+ -- duplicate found
+ t[j] = nil
+ flag = true
+ elseif t[j] == ib then
+ -- counterpart found, aggregating
+ t[i] = (ia ^ -1):network()
+ t[j] = nil
+ flag = true
+ end
end
end
end