[libgdata] [core] Fixed a crasher on oddly-formatted error messages



commit 5ba1e0437e22d9adfe24bb46ddc9af05267af246
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Apr 27 07:20:55 2009 +0100

    [core] Fixed a crasher on oddly-formatted error messages
---
 gdata/gdata-service.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index f277bb5..0087314 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -516,6 +516,9 @@ authenticate (GDataService *self, const gchar *username, const gchar *password,
 		const gchar *response_body = message->response_body->data;
 		gchar *error_start, *error_end, *uri_start, *uri_end, *uri = NULL;
 
+		if (response_body == NULL)
+			goto protocol_error;
+
 		/* Error */
 		error_start = strstr (response_body, "Error=");
 		if (error_start == NULL)
@@ -1268,14 +1271,14 @@ gdata_service_set_proxy_uri (GDataService *self, SoupURI *proxy_uri)
 gboolean
 gdata_service_is_authenticated (GDataService *self)
 {
-	g_assert (GDATA_IS_SERVICE (self));
+	g_return_val_if_fail (GDATA_IS_SERVICE (self), FALSE);
 	return self->priv->authenticated;
 }
 
 void
 _gdata_service_set_authenticated (GDataService *self, gboolean authenticated)
 {
-	g_assert (GDATA_IS_SERVICE (self));
+	g_return_if_fail (GDATA_IS_SERVICE (self));
 	self->priv->authenticated = authenticated;
 }
 



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