[couchdb-glib] Never have a NULL URI



commit ce29f6367df9f6f1ad1234cbc4f5f7a5bf8385c4
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Tue Apr 6 15:07:38 2010 +0200

    Never have a NULL URI

 couchdb-glib/couchdb-session.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/couchdb-glib/couchdb-session.c b/couchdb-glib/couchdb-session.c
index 4b960d4..725406d 100644
--- a/couchdb-glib/couchdb-session.c
+++ b/couchdb-glib/couchdb-session.c
@@ -111,7 +111,7 @@ couchdb_session_set_property (GObject         *object,
 	switch (prop_id) {
 	case PROP_URI:
 		g_free(couchdb->priv->uri);
-		couchdb->priv->uri = g_value_dup_string(value);
+		couchdb->priv->uri = g_value_dup_string (value);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -248,6 +248,9 @@ couchdb_session_init (CouchdbSession *couchdb)
 CouchdbSession *
 couchdb_session_new (const char *uri)
 {
+	if (!uri)
+		uri = "http://localhost:5984";;
+
 	return g_object_new (COUCHDB_TYPE_SESSION, "uri", uri, NULL);
 }
 



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