summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2014-01-15 08:36:47 +0100
committerSeif Lotfy <seif@lotfy.com>2014-01-15 11:12:01 +0100
commitb25d01246371ba0688fee6baa718e50c22d861c2 (patch)
tree72edffb08366444fe973aedf1d7bba4e4e613bd8
parentc1873620ad2d83af3e87dd82fdcf56b5e70a27ce (diff)
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 Signed-off-by: Seif Lotfy <seif@lotfy.com>
-rw-r--r--test/c/test-datasource.c3
-rw-r--r--test/c/test-event.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/test/c/test-datasource.c b/test/c/test-datasource.c
index 067da558..3e3ce011 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 440d3c30..abd77187 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