src: fix nullptr dereference in uv__print_handles (#4805)

This commit is contained in:
jhnh204 2025-06-15 05:16:20 +09:00 committed by GitHub
parent b00c5d1a09
commit 6a0945b333
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -575,12 +575,17 @@ static void uv__print_handles(uv_loop_t* loop, int only_active, FILE* stream) {
struct uv__queue* q;
uv_handle_t* h;
if (loop == NULL)
loop = uv_default_loop();
if (stream == NULL)
stream = stderr;
if (loop == NULL) {
loop = uv_default_loop();
if (loop == NULL) {
fprintf(stream, "uv_default_loop() failed\n");
return;
}
}
uv__queue_foreach(q, &loop->handle_queue) {
h = uv__queue_data(q, uv_handle_t, handle_queue);