/pidgin/main: 19605664e064: Make explicit that we expect js to n...

Jorge Villase?or <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 19605664e0647c6096414a9e4b4ec60233ae596c
Author:	 Jorge Villase?or <[email protected]>
Date:	 2016-05-07 15:49 -0700
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/19605664e064

Description:

Make explicit that we expect js to not be NULL

On the prpl the JabberStream is assumed to not be NULL. We can use
g_return_val_if_fail instead of checking on every instance we dereference.

diffstat:

 libpurple/protocols/jabber/presence.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (21 lines):

diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -305,6 +305,8 @@ PurpleXmlNode *jabber_presence_create_js
 	gboolean audio_enabled, video_enabled;
 #endif
 
+	g_return_val_if_fail(js !=NULL, NULL);
+
 	presence = purple_xmlnode_new("presence");
 
 	if(state == JABBER_BUDDY_STATE_UNAVAILABLE)
@@ -332,7 +334,7 @@ PurpleXmlNode *jabber_presence_create_js
 	}
 
 	/* if we are idle and not offline, include idle */
-	if (js && js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) {
+	if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) {
 		PurpleXmlNode *query = purple_xmlnode_new_child(presence, "query");
 		gchar seconds[10];
 		g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle));

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.