From d12e71865382919bdc00b29714143196c474e66b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 15 Jan 2014 08:36:47 +0100 Subject: [PATCH] Fix unit test failure if $XDG_DATA_DIRS is not set In that case g_setenv() would fail trying to set a NULL value in teardown. https://bugs.freedesktop.org/show_bug.cgi?id=73651 --- test/c/test-datasource.c | 3 ++- test/c/test-event.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/c/test-datasource.c b/test/c/test-datasource.c index 067da55..3e3ce01 100644 --- a/test/c/test-datasource.c +++ b/test/c/test-datasource.c @@ -42,7 +42,8 @@ setup (Fixture *fix, gconstpointer data) static void teardown (Fixture *fix, gconstpointer data) { - g_setenv ("XDG_DATA_DIRS", old_xdg_data_dirs, TRUE); + if (old_xdg_data_dirs != NULL) + g_setenv ("XDG_DATA_DIRS", old_xdg_data_dirs, TRUE); } static void diff --git a/test/c/test-event.c b/test/c/test-event.c index 440d3c3..abd7718 100644 --- a/test/c/test-event.c +++ b/test/c/test-event.c @@ -42,7 +42,8 @@ setup (Fixture *fix, gconstpointer data) static void teardown (Fixture *fix, gconstpointer data) { - g_setenv ("XDG_DATA_DIRS", old_xdg_data_dirs, TRUE); + if (old_xdg_data_dirs != NULL) + g_setenv ("XDG_DATA_DIRS", old_xdg_data_dirs, TRUE); } static void -- 1.8.5.2