diff options
author | David Robillard <d@drobilla.net> | 2013-02-02 20:14:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-02-02 20:14:05 +0000 |
commit | bf23b9f975ec97d20ba6381f2457e7b7d6ec0369 (patch) | |
tree | 52df2281c1dba7fed598e55d5dabe9e219f84a65 /src | |
parent | dd51340700469210bbbff0424f6ebe85d32e9524 (diff) | |
download | lilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.tar.gz lilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.tar.bz2 lilv-bf23b9f975ec97d20ba6381f2457e7b7d6ec0369.zip |
Require a URI for lilv_state_to_string() and fail gracefully otherwise.
Fail gracefully when lilv_state_new_from_string() is called on NULL.
Fixes #865.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5030 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/state.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c index d693f1a..3176fd1 100644 --- a/src/state.c +++ b/src/state.c @@ -647,6 +647,10 @@ lilv_state_new_from_string(LilvWorld* world, LV2_URID_Map* map, const char* str) { + if (!str) { + return NULL; + } + SerdNode base = SERD_NODE_NULL; SerdEnv* env = serd_env_new(&base); SordModel* model = sord_new(world->world, SORD_SPO|SORD_OPS, false); @@ -989,6 +993,11 @@ lilv_state_to_string(LilvWorld* world, const char* uri, const char* base_uri) { + if (!uri) { + LILV_ERROR("Attempt to serialise state with no URI\n"); + return NULL; + } + SerdChunk chunk = { NULL, 0 }; SerdEnv* env = NULL; SerdNode base = serd_node_from_string(SERD_URI, USTR(base_uri)); |