Loading editor/widgets/faq/faq.cpp +21 −5 Changes for editor/widgets/faq/faq.cpp: 21 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -517,16 +517,32 @@ extern "C" { json_object *jitems = nullptr; if (json_object_object_get_ex(obj, "faq_items", &jitems) && json_object_is_type(jitems, json_type_array)) { items.clear(); int len = json_object_array_length(jitems); for (int i = 0; i < len; ++i) { json_object *ji = json_object_array_get_idx(jitems, i); if (!ji) continue; // Safety check for null array elements FAQItem it; json_object *jq = nullptr, *ja = nullptr; if (json_object_object_get_ex(ji, "question", &jq)) it.question = json_object_get_string(jq) ?: ""; if (json_object_object_get_ex(ji, "answer", &ja)) it.answer = json_object_get_string(ja) ?: ""; json_object *jq = nullptr; json_object *ja = nullptr; if (json_object_object_get_ex(ji, "question", &jq) && jq) { const char* str = json_object_get_string(jq); it.question = str ? str : ""; } else { it.question = ""; } if (json_object_object_get_ex(ji, "answer", &ja) && ja) { const char* str = json_object_get_string(ja); it.answer = str ? str : ""; } else { it.answer = ""; } items.push_back(it); } } Loading Loading
editor/widgets/faq/faq.cpp +21 −5 Changes for editor/widgets/faq/faq.cpp: 21 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -517,16 +517,32 @@ extern "C" { json_object *jitems = nullptr; if (json_object_object_get_ex(obj, "faq_items", &jitems) && json_object_is_type(jitems, json_type_array)) { items.clear(); int len = json_object_array_length(jitems); for (int i = 0; i < len; ++i) { json_object *ji = json_object_array_get_idx(jitems, i); if (!ji) continue; // Safety check for null array elements FAQItem it; json_object *jq = nullptr, *ja = nullptr; if (json_object_object_get_ex(ji, "question", &jq)) it.question = json_object_get_string(jq) ?: ""; if (json_object_object_get_ex(ji, "answer", &ja)) it.answer = json_object_get_string(ja) ?: ""; json_object *jq = nullptr; json_object *ja = nullptr; if (json_object_object_get_ex(ji, "question", &jq) && jq) { const char* str = json_object_get_string(jq); it.question = str ? str : ""; } else { it.question = ""; } if (json_object_object_get_ex(ji, "answer", &ja) && ja) { const char* str = json_object_get_string(ja); it.answer = str ? str : ""; } else { it.answer = ""; } items.push_back(it); } } Loading