[evolution-data-server] CamelNetworkSettings: host and user should never be NULL.



commit a8c0435cf92a0b208b777df0d65d82bccc2ae9e0
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Nov 4 12:11:17 2011 -0400

    CamelNetworkSettings: host and user should never be NULL.
    
    Otherwise it creates nuisance runtime warnings when binding the
    properties to widgets like GtkEntry.

 camel/camel-network-settings.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-network-settings.c b/camel/camel-network-settings.c
index b62a099..e6ca300 100644
--- a/camel/camel-network-settings.c
+++ b/camel/camel-network-settings.c
@@ -182,9 +182,12 @@ camel_network_settings_set_host (CamelNetworkSettings *settings,
 
 	g_return_if_fail (CAMEL_IS_NETWORK_SETTINGS (settings));
 
+	/* Make sure this property is never NULL. */
+	if (host == NULL)
+		host = "";
+
 	/* Strip leading and trailing whitespace. */
-	if (host != NULL)
-		stripped_host = g_strstrip (g_strdup (host));
+	stripped_host = g_strstrip (g_strdup (host));
 
 	g_object_set_data_full (
 		G_OBJECT (settings),
@@ -325,9 +328,12 @@ camel_network_settings_set_user (CamelNetworkSettings *settings,
 
 	g_return_if_fail (CAMEL_IS_NETWORK_SETTINGS (settings));
 
+	/* Make sure this property is never NULL. */
+	if (user == NULL)
+		user = "";
+
 	/* Strip leading and trailing whitespace. */
-	if (user != NULL)
-		stripped_user = g_strstrip (g_strdup (user));
+	stripped_user = g_strstrip (g_strdup (user));
 
 	g_object_set_data_full (
 		G_OBJECT (settings),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]