Fix CID 1491190: explicit null dereference.
authorwwp <subscript@free.fr>
Mon, 27 Sep 2021 15:57:48 +0000 (17:57 +0200)
committerwwp <subscript@free.fr>
Mon, 27 Sep 2021 15:57:48 +0000 (17:57 +0200)
src/stock_pixmap.c

index 44b278a7c05fc46e1f73ad784417e2ef6d9f5064..d78e95a30d3c423e67f0d260efdb791edeee920c 100644 (file)
@@ -804,15 +804,21 @@ static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname)
 
 gchar *stock_pixmap_get_system_theme_dir_for_theme(const gchar *theme)
 {
-       const gchar *sep = NULL;
-       if (theme && *theme)
-               sep = G_DIR_SEPARATOR_S;
+       if (theme && *theme) {
 #ifndef G_OS_WIN32
-       return g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
-                          PIXMAP_THEME_DIR, sep, theme, NULL);
+               return g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
+                          PIXMAP_THEME_DIR, G_DIR_SEPARATOR_S, theme, NULL);
 #else
-       return g_strconcat(w32_get_themes_dir(), sep, theme, NULL);
+               return g_strconcat(w32_get_themes_dir(), G_DIR_SEPARATOR_S, theme, NULL);
 #endif
+       } else {
+#ifndef G_OS_WIN32
+               return g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
+                          PIXMAP_THEME_DIR, NULL);
+#else
+               return g_strdup(w32_get_themes_dir());
+#endif
+       }
 }
 
 GList *stock_pixmap_themes_list_new(void)