diff --git a/src/modules/cursor/cursor.c b/src/modules/cursor/cursor.c index e9d03f6e6..f3d151765 100644 --- a/src/modules/cursor/cursor.c +++ b/src/modules/cursor/cursor.c @@ -96,13 +96,14 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson if (result.error.length) { - yyjson_mut_obj_add_str(doc, module, "error", result.error.chars); - return; + yyjson_mut_obj_add_strbuf(doc, module, "error", &result.error); + } + else + { + yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result"); + yyjson_mut_obj_add_strbuf(doc, obj, "theme", &result.theme); + yyjson_mut_obj_add_strbuf(doc, obj, "size", &result.size); } - - yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result"); - yyjson_mut_obj_add_strbuf(doc, obj, "theme", &result.theme); - yyjson_mut_obj_add_strbuf(doc, obj, "size", &result.size); ffStrbufDestroy(&result.error); ffStrbufDestroy(&result.theme);