summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugin.c2
-rw-r--r--src/world.c42
2 files changed, 24 insertions, 20 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 1479bc6..ebd51b2 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -38,6 +38,8 @@
SLV2Plugin
slv2_plugin_new(SLV2World world, SLV2Value uri, librdf_uri* bundle_uri, librdf_uri* binary_uri)
{
+ assert(bundle_uri);
+ assert(binary_uri);
struct _SLV2Plugin* plugin = malloc(sizeof(struct _SLV2Plugin));
plugin->world = world;
plugin->plugin_uri = uri;
diff --git a/src/world.c b/src/world.c
index 1d2f339..2efcc40 100644
--- a/src/world.c
+++ b/src/world.c
@@ -528,33 +528,35 @@ slv2_world_load_all(SLV2World world)
librdf_node* bundle_node = librdf_query_results_get_binding_value(results, 2);
librdf_uri* bundle_uri = librdf_node_get_uri(bundle_node);
librdf_node* binary_node = librdf_query_results_get_binding_value(results, 3);
- librdf_uri* binary_uri = binary_node ? librdf_node_get_uri(binary_node) : NULL;
assert(plugin_uri);
assert(data_uri);
- // printf("PLUGIN: %s\n", librdf_uri_as_string(plugin_uri));
-
- SLV2Value uri = slv2_value_new_librdf_uri(world, plugin_uri);
-
- SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins, uri);
-
- // Create a new SLV2Plugin
- if (!plugin) {
- plugin = slv2_plugin_new(world, uri, bundle_uri, binary_uri);
- raptor_sequence_push(world->plugins, plugin);
- // FIXME: Slow! ORDER BY broken in certain versions of redland?
- raptor_sequence_sort(world->plugins, slv2_plugin_compare_by_uri);
+ if (binary_node) {
+ librdf_uri* binary_uri = librdf_node_get_uri(binary_node);
+ SLV2Value uri = slv2_value_new_librdf_uri(world, plugin_uri);
+ SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins, uri);
+
+ // Create a new SLV2Plugin
+ if (!plugin) {
+ plugin = slv2_plugin_new(world, uri, bundle_uri, binary_uri);
+ raptor_sequence_push(world->plugins, plugin);
+ // FIXME: Slow! ORDER BY broken in certain versions of redland?
+ raptor_sequence_sort(world->plugins, slv2_plugin_compare_by_uri);
+ } else {
+ slv2_value_free(uri);
+ }
+
+ plugin->world = world;
+
+ // FIXME: check for duplicates
+ raptor_sequence_push(plugin->data_uris,
+ slv2_value_new_librdf_uri(plugin->world, data_uri));
} else {
- slv2_value_free(uri);
+ fprintf(stderr, "Warning: plugin %s has no binary; ignored.\n",
+ librdf_uri_as_string(plugin_uri));
}
- plugin->world = world;
-
- // FIXME: check for duplicates
- raptor_sequence_push(plugin->data_uris,
- slv2_value_new_librdf_uri(plugin->world, data_uri));
-
librdf_free_node(plugin_node);
librdf_free_node(data_node);
librdf_free_node(bundle_node);