diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -60,11 +60,10 @@ lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) switch (type) { case LILV_VALUE_URI: val->val.uri_val = sord_new_uri(world->world, (const uint8_t*)str); - val->str_val = (char*)sord_node_get_string(val->val.uri_val); break; case LILV_VALUE_BLANK: val->val.uri_val = sord_new_blank(world->world, (const uint8_t*)str); - val->str_val = (char*)sord_node_get_string(val->val.uri_val); + break; case LILV_VALUE_STRING: case LILV_VALUE_INT: case LILV_VALUE_FLOAT: @@ -74,6 +73,17 @@ lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) break; } + switch (type) { + case LILV_VALUE_URI: + case LILV_VALUE_BLANK: + if (!val->val.uri_val) { + free(val); + return NULL; + } + val->str_val = (char*)sord_node_get_string(val->val.uri_val); + default: break; + } + return val; } |