Skip to content

Commit d97cf72

Browse files
authored
Merge pull request 20tab#628 from slartibaartfast/iss602
Adds version checking before calling TCHAR_TO_WCHAR
2 parents 078908e + 38599ea commit d97cf72

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Source/UnrealEnginePython/Private/PyCommandlet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ int32 UPyCommandlet::Main(const FString& CommandLine)
9191
#if PY_MAJOR_VERSION >= 3
9292
argv[i] = (wchar_t*)malloc(PyArgv[i].Len() + 1);
9393
#if PLATFORM_MAC || PLATFORM_LINUX
94+
#if ENGINE_MINOR_VERSION >= 20
9495
wcsncpy(argv[i], (const wchar_t *) TCHAR_TO_WCHAR(*PyArgv[i].ReplaceEscapedCharWithChar()), PyArgv[i].Len() + 1);
96+
#else
97+
wcsncpy(argv[i], *PyArgv[i].ReplaceEscapedCharWithChar(), PyArgv[i].Len() + 1);
98+
#endif
9599
#elif PLATFORM_ANDROID
96100
wcsncpy(argv[i], (const wchar_t *)*PyArgv[i].ReplaceEscapedCharWithChar(), PyArgv[i].Len() + 1);
97101
#else

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ void FUnrealEnginePythonModule::UESetupPythonInterpreter(bool verbose)
121121
for (int32 i = 0; i < Args.Num(); i++)
122122
{
123123
#if PY_MAJOR_VERSION >= 3
124+
#if ENGINE_MINOR_VERSION >= 20
124125
argv[i] = (wchar_t *)(TCHAR_TO_WCHAR(*Args[i]));
126+
#else
127+
argv[i] = (wchar_t *)(*Args[i]);
128+
#endif
125129
#else
126130
argv[i] = TCHAR_TO_UTF8(*Args[i]);
127131
#endif

0 commit comments

Comments
 (0)