comparison pidgin/plugins/xmppconsole.c @ 17661:a4c1e66620e3

Fix a crash when trying to use XMPP console with no XMPP accounts connected
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 02 Jun 2007 16:06:59 +0000
parents 3d41d0d7fb9b
children 2a6fb7c6d030
comparison
equal deleted inserted replaced
17660:8e20bb5640ed 17661:a4c1e66620e3
181 PurpleConnection *gc = console->gc; 181 PurpleConnection *gc = console->gc;
182 GtkTextBuffer *buffer; 182 GtkTextBuffer *buffer;
183 char *text; 183 char *text;
184 184
185 gc = console->gc; 185 gc = console->gc;
186 186
187 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); 187 if (gc)
188 188 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
189
189 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry)); 190 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(console->entry));
190 gtk_text_buffer_get_start_iter(buffer, &start); 191 gtk_text_buffer_get_start_iter(buffer, &start);
191 gtk_text_buffer_get_end_iter(buffer, &end); 192 gtk_text_buffer_get_end_iter(buffer, &end);
192 193
193 text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end); 194 text = gtk_imhtml_get_text(GTK_IMHTML(console->entry), &start, &end);
194 195
195 if (gc && prpl_info->convo_closed != NULL) 196 if (prpl_info && prpl_info->send_raw != NULL)
196 prpl_info->send_raw(gc, text, strlen(text)); 197 prpl_info->send_raw(gc, text, strlen(text));
197 198
198 g_free(text); 199 g_free(text);
199 gtk_imhtml_clear(GTK_IMHTML(console->entry)); 200 gtk_imhtml_clear(GTK_IMHTML(console->entry));
200 } 201 }