From c8ccf053ff98da6745ac1ecc311b6925e08f60cf Mon Sep 17 00:00:00 2001 From: o9000 Date: Mon, 26 Jun 2017 11:08:31 +0200 Subject: [PATCH] tint2conf: fix segfault in corner case --- src/tint2conf/theme_view.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tint2conf/theme_view.c b/src/tint2conf/theme_view.c index 74ef7b0..c9848d2 100644 --- a/src/tint2conf/theme_view.c +++ b/src/tint2conf/theme_view.c @@ -145,10 +145,16 @@ void theme_list_append(const gchar *path) GtkTreeIter iter; gtk_list_store_append(theme_list_store, &iter); - gchar *name = strrchr(path, '/') + 1; + gchar *name, *dir; - gchar *dir = g_strdup(path); - strrchr(dir, '/')[0] = 0; + if (strchr(path, '/')) { + name = strrchr(path, '/') + 1; + dir = g_strdup(path); + strrchr(dir, '/')[0] = 0; + } else { + name = (gchar*)path; + dir = g_strdup("."); + } char *suffix = contract_tilde(dir); g_free(dir);