From d11bfa3ef5e8d63068096c52bc2faccba65b0b47 Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Fri, 8 Nov 2019 16:18:20 -0500 Subject: [PATCH] Make core.get_favorites("local") ignore duplicates (#7926) --- src/serverlist.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 7d3ab4bbb..18264e933 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -155,6 +155,16 @@ std::vector deSerialize(const std::string &liststring) server["address"] = tmp; std::getline(stream, tmp); server["port"] = tmp; + bool unique = true; + for (const ServerListSpec &added : serverlist) { + if (server["name"] == added["name"] + && server["port"] == added["port"]) { + unique = false; + break; + } + } + if (!unique) + continue; std::getline(stream, tmp); server["description"] = tmp; serverlist.push_back(server); -- 2.25.1