Added null check to convertSystemString [MT5]

Whithout this fix, the OrderSend method crashing if we doesn't set the "request.Comment" property.
This commit is contained in:
Tr4Dr
2017-09-18 14:55:03 +02:00
parent a7cb14de25
commit f7b00a8d88
+9 -3
View File
@@ -51,9 +51,15 @@ public struct CMqlBookInfo
void convertSystemString(wchar_t* dest, String^ src) void convertSystemString(wchar_t* dest, String^ src)
{ {
pin_ptr<const wchar_t> wch = PtrToStringChars(src); if (src != nullptr) {
memcpy(dest, wch, wcsnlen(wch, 1000) * sizeof(wchar_t)); pin_ptr<const wchar_t> wch = PtrToStringChars(src);
dest[wcsnlen(wch, 1000)] = L'\0'; memcpy(dest, wch, wcsnlen(wch, 1000) * sizeof(wchar_t));
dest[wcsnlen(wch, 1000)] = L'\0';
}
else
{
dest[0] = L'\0';
}
} }
#define _DLLAPI extern "C" __declspec(dllexport) #define _DLLAPI extern "C" __declspec(dllexport)