Skip to content

Commit 0e35b8d

Browse files
[mono] Ensure exception_message points to a string (#66991)
1 parent 2bf30a0 commit 0e35b8d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mono/mono/eventpipe/ep-rt-mono.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3479,10 +3479,14 @@ ep_rt_mono_write_event_exception_thrown (MonoObject *obj)
34793479
flags |= EXCEPTION_THROWN_FLAGS_IS_CLS_COMPLIANT;
34803480
if (exception->inner_ex)
34813481
flags |= EXCEPTION_THROWN_FLAGS_HAS_INNER;
3482-
exception_message = ep_rt_utf16_to_utf8_string (mono_string_chars_internal (exception->message), mono_string_length_internal (exception->message));
3482+
if (exception->message)
3483+
exception_message = ep_rt_utf16_to_utf8_string (mono_string_chars_internal (exception->message), mono_string_length_internal (exception->message));
34833484
hresult = exception->hresult;
34843485
}
34853486

3487+
if (exception_message == NULL)
3488+
exception_message = g_strdup ("");
3489+
34863490
if (mono_get_eh_callbacks ()->mono_walk_stack_with_ctx)
34873491
mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (get_exception_ip_func, NULL, MONO_UNWIND_SIGNAL_SAFE, (void *)&ip);
34883492

0 commit comments

Comments
 (0)