0adf253e073d020430aaceee20afe4aff2f16aec
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index a49e950..7030555 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -227,13 +227,26 @@ get_cookies_for_domain (SoupCookieJar *jar, const char *domain)
 	return cookies;
 }
 
+/**
+ * soup_cookie_jar_add_cookie:
+ * @jar: a #SoupCookieJar
+ * @cookie: a #SoupCookie
+ *
+ * Adds @cookie to @jar, emitting the 'changed' signal if we are modifying
+ * an existing cookie or adding a valid new cookie ('valid' means
+ * that the cookie's expire date is not in the past).
+ **/
 void
 soup_cookie_jar_add_cookie (SoupCookieJar *jar, SoupCookie *cookie)
 {
-	SoupCookieJarPrivate *priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+	SoupCookieJarPrivate *priv;
 	GSList *old_cookies, *oc, *prev = NULL;
 	SoupCookie *old_cookie;
 
+	g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
+	g_return_if_fail (cookie != NULL);
+
+	priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
 	old_cookies = get_cookies_for_domain (jar, cookie->domain);
 	for (oc = old_cookies; oc; oc = oc->next) {
 		old_cookie = oc->data;
