diff options
author | Thomas White <taw@physics.org> | 2018-11-09 20:46:31 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-11-09 20:46:31 +0100 |
commit | d669499b143316318f12c091173196c85e57527f (patch) | |
tree | 93b7bdc0269b1294cb7b0efb8d6c1fcdf38decff /src/stylesheet.c | |
parent | 1869d2648f4461f44350bf5014368117bd1df492 (diff) |
Set furniture values in SS editor
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r-- | src/stylesheet.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c index 52bc4ff..51e8bd4 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -133,7 +133,12 @@ static JsonObject *find_stylesheet_object(Stylesheet *ss, const char *path, node = json_path_query(path, ss->root, &err); array = json_node_get_array(node); - if ( json_array_get_length(array) != 1 ) { + if ( json_array_get_length(array) == 0 ) { + json_node_unref(node); + return NULL; + } + + if ( json_array_get_length(array) > 1 ) { json_node_unref(node); fprintf(stderr, "More than one result in SS lookup (%s)!\n", path); return NULL; @@ -158,11 +163,12 @@ char *stylesheet_lookup(Stylesheet *ss, const char *path, const char *key) JsonNode *node = NULL; if ( ss == NULL ) { - fprintf(stderr, _("No stylesheet!\n")); + fprintf(stderr, "No stylesheet!\n"); return NULL; } obj = find_stylesheet_object(ss, path, &node); + if ( obj == NULL ) return NULL; if ( json_object_has_member(obj, key) ) { |