comparison src/gtkconv.c @ 13419:3e9c865abd3f

[gaim-migrate @ 15794] Resolve CID 22: Event assign_zero: Variable "prpl_info" assigned value 0. 3764 GaimPluginProtocolInfo *prpl_info = NULL; 3795 if (gc != NULL) 3796 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); Event var_deref_op: Variable "prpl_info" tracked as NULL was dereferenced. 3798 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) Basically, if gc == NULL, then prpl_info == NULL, so this crashes. Let's be safe and use a g_return_if_fail(). I also added one to the write_conv stuff I changed in my last commit. We seem to do that in a lot of places, so I guess I'll p lay it safe. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 07 Mar 2006 02:09:05 +0000
parents 7d1ebac854ba
children d52b9874c0de
comparison
equal deleted inserted replaced
13418:ad33debf87b4 13419:3e9c865abd3f
3760 } 3760 }
3761 3761
3762 static GtkWidget * 3762 static GtkWidget *
3763 setup_chat_pane(GaimGtkConversation *gtkconv) 3763 setup_chat_pane(GaimGtkConversation *gtkconv)
3764 { 3764 {
3765 GaimPluginProtocolInfo *prpl_info = NULL; 3765 GaimPluginProtocolInfo *prpl_info;
3766 GaimConversation *conv = gtkconv->active_conv; 3766 GaimConversation *conv = gtkconv->active_conv;
3767 GaimGtkChatPane *gtkchat; 3767 GaimGtkChatPane *gtkchat;
3768 GaimConnection *gc; 3768 GaimConnection *gc;
3769 GtkWidget *vpaned, *hpaned; 3769 GtkWidget *vpaned, *hpaned;
3770 GtkWidget *vbox, *hbox, *frame; 3770 GtkWidget *vbox, *hbox, *frame;
3781 void *blist_handle = gaim_blist_get_handle(); 3781 void *blist_handle = gaim_blist_get_handle();
3782 GList *focus_chain = NULL; 3782 GList *focus_chain = NULL;
3783 3783
3784 gtkchat = gtkconv->u.chat; 3784 gtkchat = gtkconv->u.chat;
3785 gc = gaim_conversation_get_gc(conv); 3785 gc = gaim_conversation_get_gc(conv);
3786 g_return_if_fail(gc != NULL);
3787 g_return_if_fail(gc->prpl != NULL);
3788 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
3786 3789
3787 /* Setup the outer pane. */ 3790 /* Setup the outer pane. */
3788 vpaned = gtk_vpaned_new(); 3791 vpaned = gtk_vpaned_new();
3789 gtk_widget_show(vpaned); 3792 gtk_widget_show(vpaned);
3790 3793
3791 /* Setup the top part of the pane. */ 3794 /* Setup the top part of the pane. */
3792 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 3795 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
3793 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE); 3796 gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE);
3794 gtk_widget_show(vbox); 3797 gtk_widget_show(vbox);
3795
3796 if (gc != NULL)
3797 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
3798 3798
3799 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC) 3799 if (prpl_info->options & OPT_PROTO_CHAT_TOPIC)
3800 { 3800 {
3801 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); 3801 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
3802 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); 3802 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
4605 /* TODO: consider not doing this if the account is offline or something */ 4605 /* TODO: consider not doing this if the account is offline or something */
4606 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)) 4606 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))
4607 gaim_gtkconv_set_active_conversation(conv); 4607 gaim_gtkconv_set_active_conversation(conv);
4608 type = gaim_conversation_get_type(conv); 4608 type = gaim_conversation_get_type(conv);
4609 4609
4610 gc = gaim_conversation_get_gc(conv);
4611 account = gaim_conversation_get_account(conv); 4610 account = gaim_conversation_get_account(conv);
4611 g_return_if_fail(account != NULL);
4612 gc = gaim_account_get_connection(account);
4613 g_return_if_fail(gc != NULL);
4612 4614
4613 displaying = g_strdup(message); 4615 displaying = g_strdup(message);
4614 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( 4616 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1(
4615 gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? 4617 gaim_gtk_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ?
4616 "displaying-im-msg" : "displaying-chat-msg"), 4618 "displaying-im-msg" : "displaying-chat-msg"),