summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-01-09 16:23:00 -0500
committerDavid Robillard <d@drobilla.net>2024-01-09 17:27:48 -0500
commit81bd78db915bc0d11f23386e49ffe29968ded486 (patch)
treebcb2aedb2c48e9f8dc3d0f3b8055488e6fd62638 /test
parent8ebaf1387735173e72ab79eeda2de328cd279e12 (diff)
downloadlilv-81bd78db915bc0d11f23386e49ffe29968ded486.tar.gz
lilv-81bd78db915bc0d11f23386e49ffe29968ded486.tar.bz2
lilv-81bd78db915bc0d11f23386e49ffe29968ded486.zip
Fix null dereference when trying to load state from a missing file
Diffstat (limited to 'test')
-rw-r--r--test/test_state.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_state.c b/test/test_state.c
index cb84fb4..3ab2148 100644
--- a/test/test_state.c
+++ b/test/test_state.c
@@ -1018,6 +1018,18 @@ test_bad_subject(void)
}
static void
+test_missing_path(void)
+{
+ TestContext* const ctx = test_context_new();
+ LilvState* const state = lilv_state_new_from_file(
+ ctx->env->world, &ctx->map, NULL, "/does/not/exist");
+
+ assert(!state);
+
+ test_context_free(ctx);
+}
+
+static void
count_file(const char* path, const char* name, void* data)
{
(void)path;
@@ -1105,6 +1117,7 @@ main(void)
test_world_round_trip();
test_label_round_trip();
test_bad_subject();
+ test_missing_path();
test_delete();
return 0;