Skip to content

Commit 64e4e49

Browse files
committed
* get_il2cpp_string check null pointer
1 parent 9e7918c commit 64e4e49

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ScriptEngine/lib/libScriptEngine.a

96 Bytes
Binary file not shown.

ScriptEngine/main/Mediator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ void* get_il2cpp_internal_ptr(Il2CppObject* obj)
168168

169169
MonoString* get_mono_string(Il2CppString* str)
170170
{
171+
if(str == NULL)
172+
return NULL;
171173
/*char* ptr = (char*)str;
172174
int32_t* lenPtr = (int32_t*)(ptr + sizeof(void *) * 2);
173175
int32_t len = *lenPtr;
@@ -180,6 +182,9 @@ MonoString* get_mono_string(Il2CppString* str)
180182
}
181183
Il2CppString* get_il2cpp_string(MonoString* str)
182184
{
185+
if(str == NULL)
186+
return NULL;
187+
183188
int32_t len = mono_string_length(str);
184189
Il2CppChar* chars = (Il2CppChar* )mono_string_to_utf16(str);
185190

0 commit comments

Comments
 (0)