mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 12:31:49 +00:00
solokey: Prevent a critical warning when parsing invalid JSON data
This commit is contained in:
parent
c79e76d2aa
commit
84e8d24540
@ -55,6 +55,13 @@ fu_solokey_firmware_parse (FuFirmware *firmware,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
json_root = json_parser_get_root (parser);
|
json_root = json_parser_get_root (parser);
|
||||||
|
if (json_root == NULL || !JSON_NODE_HOLDS_OBJECT (json_root)) {
|
||||||
|
g_set_error_literal (error,
|
||||||
|
FWUPD_ERROR,
|
||||||
|
FWUPD_ERROR_INVALID_FILE,
|
||||||
|
"JSON invalid as has no root");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
json_obj = json_node_get_object (json_root);
|
json_obj = json_node_get_object (json_root);
|
||||||
if (!json_object_has_member (json_obj, "firmware")) {
|
if (!json_object_has_member (json_obj, "firmware")) {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
|
Loading…
Reference in New Issue
Block a user