Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Core/GameEngine/Source/GameNetwork/GameSpy/Thread/ThreadUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ std::wstring MultiByteToWideCharSingleLine( const char *orig )
std::string WideCharStringToMultiByte( const WideChar *orig )
{
std::string ret;

// Check for null pointer to prevent crash
if (orig == NULL)
{
return ret; // Return empty string
}

// Check for empty string to avoid unnecessary processing
if (orig[0] == 0)
{
return ret; // Return empty string
}

Int len = WideCharToMultiByte( CP_UTF8, 0, orig, wcslen(orig), NULL, 0, NULL, NULL ) + 1;
if (len > 0)
{
Expand Down
Loading