diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-10-27 23:54:56 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-10-27 23:54:56 +0200 |
commit | 05e29e56ce7accdf7216566a5698caac96e8bd43 (patch) | |
tree | 97a96f042b1672a9cb9d992d91f5a26c9d1998c4 /src/stylesheet.c | |
parent | 7e36b2a0fc2180d8d319b54159a6680801247ba4 (diff) |
Handle condition of no stylesheet, and load default stylesheet for empty presentation
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r-- | src/stylesheet.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c index b5dce52..96172a4 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -155,6 +155,11 @@ char *stylesheet_lookup(Stylesheet *ss, const char *path, const char *key) char *ret = NULL; JsonNode *node = NULL; + if ( ss == NULL ) { + fprintf(stderr, _("No stylesheet!\n")); + return NULL; + } + obj = find_stylesheet_object(ss, path, &node); if ( json_object_has_member(obj, key) ) { @@ -181,6 +186,11 @@ int stylesheet_set(Stylesheet *ss, const char *path, const char *key, JsonNode *node = NULL; int r = 1; + if ( ss == NULL ) { + fprintf(stderr, _("No stylesheet!\n")); + return 1; + } + obj = find_stylesheet_object(ss, path, &node); if ( obj != NULL ) { json_object_set_string_member(obj, key, new_val); @@ -199,6 +209,11 @@ int stylesheet_delete(Stylesheet *ss, const char *path, const char *key) JsonNode *node = NULL; int r = 1; + if ( ss == NULL ) { + fprintf(stderr, _("No stylesheet!\n")); + return 1; + } + obj = find_stylesheet_object(ss, path, &node); if ( obj != NULL ) { json_object_remove_member(obj, key); |