Do not crash if "127.0.0.1" is not present

This commit is contained in:
Johan Wikman 2018-02-08 12:38:57 +02:00
parent 99b08a0d6a
commit 458edb9b1d

View File

@ -78,7 +78,13 @@ void get_maxscale_ips(TestConnections& test, vector<string>* pIps)
to_collection(output, "\n", pIps);
transform(pIps->begin(), pIps->end(), pIps->begin(), extract_ip);
pIps->erase(find(pIps->begin(), pIps->end(), "127.0.0.1"));
// Remove 127.0.0.1 if it is present.
auto i = find(pIps->begin(), pIps->end(), "127.0.0.1");
if (i != pIps->end())
{
pIps->erase(i);
}
}
}