summaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/node.c b/src/node.c
index de35175..429466f 100644
--- a/src/node.c
+++ b/src/node.c
@@ -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;
}