From e63b7779161c145a974eea3224206c487bcda07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 1 Nov 2025 16:44:36 +0800 Subject: [PATCH] GPU: handles missing GPU type as null in JSON output --- src/modules/gpu/gpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 64fb14380..723a2cebe 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -386,9 +386,12 @@ bool ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_ { case FF_GPU_TYPE_INTEGRATED: type = "Integrated"; break; case FF_GPU_TYPE_DISCRETE: type = "Discrete"; break; - default: type = "Unknown"; break; + default: type = NULL; break; } - yyjson_mut_obj_add_str(doc, obj, "type", type); + if (type) + yyjson_mut_obj_add_str(doc, obj, "type", type); + else + yyjson_mut_obj_add_null(doc, obj, "type"); yyjson_mut_obj_add_strbuf(doc, obj, "vendor", &gpu->vendor);