From: Paul Ouellette Date: Fri, 8 Nov 2019 21:18:20 +0000 (-0500) Subject: Make core.get_favorites("local") ignore duplicates (#7926) X-Git-Tag: 5.2.0~304 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d11bfa3ef5e8d63068096c52bc2faccba65b0b47;p=oweals%2Fminetest.git Make core.get_favorites("local") ignore duplicates (#7926) --- 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);