error: nimmt zahl aus schleife für position von . her

This commit is contained in:
Markus 2019-08-31 20:01:18 +02:00
parent 39ca4722c5
commit 19b16f1d15
1 changed files with 5 additions and 2 deletions

View File

@ -1047,13 +1047,16 @@ int setS5ProxytoSettings(Settings &settings, std::string Optarg)
//Überprüfe ob Ip aus 4 * '.' besteht und dann eine Zahl ist:
std::string tmpIp = settings.proxy_ip;
for (int i = 0; i < 4; ++i) {
if(tmpIp.find(".") != std::string::npos)
tmpIp.erase(static_cast<size_t>(i), 1);
if(tmpIp.find(".") != std::string::npos) {
tmpIp.erase(static_cast<size_t>(tmpIp.find(".")), 1);
}
else {
std::cout << " => Error: Ungültige Socks5 Proxy Ip Addresse: " << settings.proxy_ip << std::endl;
return 3;
}
}
std::cout << " nach Loop: " << tmpIp << std::endl;

if(!isNumber(tmpIp)) {
std::cout << " => Error: Ungültige Socks5 Proxy Ip Addresse: " << settings.proxy_ip << std::endl;
return 4;