aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-07 14:20:12 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-07 22:21:03 +0000
commit600b84f4c1f35252f8d748098b838c3f4ca20d09 (patch)
tree44755d82505aec96a10f67d3e96a0ccd1daa3e8d
parent62fc862bc60f2a044dcae2191aca7f6bd54f3afc (diff)
Clean up the null pointer check in profile_exists().
Check only in the if (global) case, and note that it's necessary in that case; in the !global case, note why we don't have to check for a null pointer. Change-Id: I80322204ec94eb3901f7bceabccb29351794adc8 Reviewed-on: https://code.wireshark.org/review/25674 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--wsutil/filesystem.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index aec82a6c2f..7a2832af36 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -1465,10 +1465,13 @@ profile_exists(const gchar *profilename, gboolean global)
{
gchar *path = NULL, *global_path;
- if (!profilename && global)
- return FALSE;
-
if (global) {
+ /*
+ * If we're looking up a global profile, we must have a
+ * profile name.
+ */
+ if (!profilename)
+ return FALSE;
global_path = get_global_profiles_dir();
path = g_strdup_printf ("%s%s%s", global_path,
G_DIR_SEPARATOR_S, profilename);
@@ -1478,6 +1481,10 @@ profile_exists(const gchar *profilename, gboolean global)
return TRUE;
}
} else {
+ /*
+ * If we didn't supply a profile name, i.e. if profilename is
+ * null, get_persconffile_dir() returns the default profile.
+ */
path = get_persconffile_dir (profilename);
if (test_for_directory (path) == EISDIR) {
g_free (path);