mirror of https://github.com/PCSX2/pcsx2.git
Common/StringUtil: Handle error returns in StdStringFromFormatV()
This commit is contained in:
parent
b1d6d84e6f
commit
c07c942659
|
@ -49,8 +49,14 @@ namespace StringUtil
|
|||
va_end(ap_copy);
|
||||
|
||||
std::string ret;
|
||||
|
||||
// If an encoding error occurs, len is -1. Which we definitely don't want to resize to.
|
||||
if (len > 0)
|
||||
{
|
||||
ret.resize(len);
|
||||
std::vsnprintf(ret.data(), ret.size() + 1, format, ap);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue