changeset 5680:71cc0d5376c2

[gaim-migrate @ 6098] Fixed some warnings found by the new sanity checks. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 02 Jun 2003 22:30:25 +0000
parents 0a0116686d51
children 46d7ad0dfa26
files src/conversation.c src/gtkconv.c
diffstat 2 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Mon Jun 02 22:24:07 2003 +0000
+++ b/src/conversation.c	Mon Jun 02 22:30:25 2003 +0000
@@ -754,7 +754,8 @@
 	GaimWindowUiOps *ops;
 
 	g_return_if_fail(win != NULL);
-	g_return_if_fail(index >= 0 &&gaim_window_get_conversation_count(win));
+	g_return_if_fail(index >= 0 &&
+					 index < gaim_window_get_conversation_count(win));
 
 	ops = gaim_window_get_ui_ops(win);
 
@@ -772,6 +773,9 @@
 
 	g_return_val_if_fail(win != NULL, NULL);
 
+	if (gaim_window_get_conversation_count(win) == 0)
+		return NULL;
+
 	ops = gaim_window_get_ui_ops(win);
 
 	if (ops != NULL && ops->get_active_index != NULL)
--- a/src/gtkconv.c	Mon Jun 02 22:24:07 2003 +0000
+++ b/src/gtkconv.c	Mon Jun 02 22:30:25 2003 +0000
@@ -331,6 +331,9 @@
 
 	conv = gaim_window_get_active_conversation(win);
 
+	if (conv == NULL)
+		return;
+
 	gaim_conversation_set_logging(conv,
 			gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
 }
@@ -3732,10 +3735,17 @@
 gaim_gtk_get_active_index(const GaimWindow *win)
 {
 	GaimGtkWindow *gtkwin;
+	int index;
 
 	gtkwin = GAIM_GTK_WINDOW(win);
 
-	return gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook));
+	index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook));
+
+	/*
+	 * A fix, because the first conversation may be active, but not
+	 * appear in the notebook just yet. -- ChipX86
+	 */
+	return (index == -1 ? 0 : index);
 }
 
 static GaimWindowUiOps window_ui_ops =