[librest/wip/baedert/gtask2: 2/8] rest-proxy: Add some missing preconditions



commit 672c2b8a6d379ca71c328cbcc30a20532fe46a4e
Author: Timm Bäder <mail baedert org>
Date:   Thu Jul 14 12:33:34 2016 +0200

    rest-proxy: Add some missing preconditions

 rest/rest-proxy.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index 9061221..086c217 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -437,6 +437,8 @@ RestProxy *
 rest_proxy_new (const gchar *url_format,
                 gboolean     binding_required)
 {
+  g_return_val_if_fail (url_format != NULL, NULL);
+
   return g_object_new (REST_TYPE_PROXY,
                        "url-format", url_format,
                        "binding-required", binding_required,
@@ -465,6 +467,10 @@ rest_proxy_new_with_authentication (const gchar *url_format,
                                     const gchar *username,
                                     const gchar *password)
 {
+  g_return_val_if_fail (url_format != NULL, NULL);
+  g_return_val_if_fail (username != NULL, NULL);
+  g_return_val_if_fail (password != NULL, NULL);
+
   return g_object_new (REST_TYPE_PROXY,
                        "url-format", url_format,
                        "binding-required", binding_required,
@@ -503,11 +509,11 @@ rest_proxy_bind_valist (RestProxy *proxy,
 gboolean
 rest_proxy_bind (RestProxy *proxy, ...)
 {
-  g_return_val_if_fail (REST_IS_PROXY (proxy), FALSE);
-
   gboolean res;
   va_list params;
 
+  g_return_val_if_fail (REST_IS_PROXY (proxy), FALSE);
+
   va_start (params, proxy);
   res = rest_proxy_bind_valist (proxy, params);
   va_end (params);
@@ -562,6 +568,7 @@ rest_proxy_add_soup_feature (RestProxy *proxy, SoupSessionFeature *feature)
   RestProxyPrivate *priv = GET_PRIVATE (proxy);
 
   g_return_if_fail (REST_IS_PROXY(proxy));
+  g_return_if_fail (feature != NULL);
   g_return_if_fail (priv->session != NULL);
 
   soup_session_add_feature (priv->session, feature);


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