changeset 15898:fd6e3382e734

Trying to find a pref with the name NULL or a name that doesn't start with '/' is invalid.
author Mark Doliner <mark@kingant.net>
date Sat, 24 Mar 2007 23:11:15 +0000
parents 36bcca5e40e9
children 4e44a9eaceec
files libpurple/prefs.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/prefs.c	Sat Mar 24 22:55:24 2007 +0000
+++ b/libpurple/prefs.c	Sat Mar 24 23:11:15 2007 +0000
@@ -87,9 +87,9 @@
 static struct
 purple_pref *find_pref(const char *name)
 {
-	if (!name || name[0] != '/')
-		return NULL;
-	else if (name[1] == '\0')
+	g_return_val_if_fail(name != NULL && name[0] == '/', NULL);
+
+	if (name[1] == '\0')
 		return &prefs;
 	else
 		return g_hash_table_lookup(prefs_hash, name);