summaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-07-06 21:25:07 +0000
committerDavid Robillard <d@drobilla.net>2012-07-06 21:25:07 +0000
commit949f0c6d5fd353909f210a9ec1975bf4a545fc27 (patch)
treea359ee6520f12ca9490dfc98ee80fb662c0ef09b /src/node.c
parent673ed3d0ce33a728f3b9a88bdb82be1f5522a27f (diff)
downloadlilv-949f0c6d5fd353909f210a9ec1975bf4a545fc27.tar.gz
lilv-949f0c6d5fd353909f210a9ec1975bf4a545fc27.tar.bz2
lilv-949f0c6d5fd353909f210a9ec1975bf4a545fc27.zip
Fix crash when lv2info is run with an invalid URI argument.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4508 a436a847-0d15-0410-975c-d299462d15a1
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;
}