mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Merge branch '3.3.5' of https://github.com/TrinityCore/TrinityCore into 3.3.5
This commit is contained in:
@@ -260,9 +260,23 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
if (wsize > 0)
|
||||
// Replace the converted string with an error message if there is enough space
|
||||
// Otherwise just return an empty string
|
||||
wchar_t const* errorMessage = L"An error occurred converting string from UTF-8 to WStr";
|
||||
size_t errorMessageLength = wcslen(errorMessage);
|
||||
if (wsize >= errorMessageLength)
|
||||
{
|
||||
wcscpy(wstr, errorMessage);
|
||||
wsize = wcslen(wstr);
|
||||
}
|
||||
else if (wsize > 0)
|
||||
{
|
||||
wstr[0] = L'\0';
|
||||
wsize = 0;
|
||||
wsize = 0;
|
||||
}
|
||||
else
|
||||
wsize = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user