1
0
mirror of https://github.com/The-Powder-Toy/The-Powder-Toy.git synced 2025-03-28 18:12:31 +01:00

Fix number to string conversion failing after a failed string to number

conversion
This commit is contained in:
mniip 2018-05-03 04:55:20 +03:00
parent 5d80d77f55
commit 730cf0806a

@ -399,6 +399,7 @@ String::Split String::SplitSigned(long long int &value, size_t pos, std::ios_bas
LocaleImpl.wstream >> value; LocaleImpl.wstream >> value;
if(LocaleImpl.wstream.fail()) if(LocaleImpl.wstream.fail())
{ {
LocaleImpl.wstream.clear();
LocaleImpl.FlushWStream(); LocaleImpl.FlushWStream();
return Split(*this, pos, npos, 0, false); return Split(*this, pos, npos, 0, false);
} }
@ -414,6 +415,7 @@ String::Split String::SplitUnsigned(unsigned long long int &value, size_t pos, s
LocaleImpl.wstream >> value; LocaleImpl.wstream >> value;
if(LocaleImpl.wstream.fail()) if(LocaleImpl.wstream.fail())
{ {
LocaleImpl.wstream.clear();
LocaleImpl.FlushWStream(); LocaleImpl.FlushWStream();
return Split(*this, pos, npos, 0, false); return Split(*this, pos, npos, 0, false);
} }
@ -429,6 +431,7 @@ String::Split String::SplitFloat(double &value, size_t pos, std::ios_base::fmtfl
LocaleImpl.wstream >> value; LocaleImpl.wstream >> value;
if(LocaleImpl.wstream.fail()) if(LocaleImpl.wstream.fail())
{ {
LocaleImpl.wstream.clear();
LocaleImpl.FlushWStream(); LocaleImpl.FlushWStream();
return Split(*this, pos, npos, 0, false); return Split(*this, pos, npos, 0, false);
} }