Skip to content
Snippets Groups Projects
Commit 86b77f39 authored by Ludovico de Nittis's avatar Ludovico de Nittis
Browse files

graphics.c: Check for empty json file


If we have an empty json file `json_node_get_object` will fail.
Add a check before it and return with SRT_GRAPHICS_ISSUES_CANNOT_LOAD

Signed-off-by: default avatarLudovico de Nittis <ludovico.denittis@collabora.com>
parent 280e8937
No related branches found
No related tags found
1 merge request!121graphics.c: Check for empty json file
Pipeline #2946 passed
......@@ -357,6 +357,14 @@ _srt_process_wflinfo (JsonParser *parser, const gchar **version_string, const gc
SrtGraphicsIssues issues = SRT_GRAPHICS_ISSUES_NONE;
JsonNode *node = json_parser_get_root (parser);
if (node == NULL)
{
g_debug ("The json output is empty");
issues |= SRT_GRAPHICS_ISSUES_CANNOT_LOAD;
return issues;
}
JsonObject *object = json_node_get_object (node);
JsonNode *sub_node = NULL;
JsonObject *sub_object = NULL;
......@@ -405,6 +413,14 @@ _srt_process_vulkaninfo (JsonParser *parser, gchar **new_version_string, const g
SrtGraphicsIssues issues = SRT_GRAPHICS_ISSUES_NONE;
JsonNode *node = json_parser_get_root (parser);
if (node == NULL)
{
g_debug ("The json output is empty");
issues |= SRT_GRAPHICS_ISSUES_CANNOT_LOAD;
return issues;
}
JsonObject *object = json_node_get_object (node);
JsonNode *sub_node = NULL;
JsonObject *sub_object = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment