changeset 5924:c304abc3e68b

[gaim-migrate @ 6364] This should fix the bug where Set User Info would sometimes crash. It attempted to access a field in account, which on the old system was a static buffer, and would always have some kind of value, but in the new one, it could be NULL. Kaboom! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 20 Jun 2003 03:32:42 +0000
parents 1afd1ffd329a
children 6690934e5ea6
files src/dialogs.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Fri Jun 20 01:57:55 2003 +0000
+++ b/src/dialogs.c	Fri Jun 20 03:32:42 2003 +0000
@@ -2192,6 +2192,7 @@
 	GtkWidget *frame;
 	gchar *buf;
 	GaimAccount *account;
+	const char *user_info;
 
 	struct set_info_dlg *b = g_new0(struct set_info_dlg, 1);
 	account = gc->account;
@@ -2222,11 +2223,15 @@
 	b->text = gtk_text_view_new();
 	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR);
 	gtk_widget_set_size_request(b->text, 300, 200);
-	buf = g_malloc(strlen(account->user_info) + 1);
-	strncpy_nohtml(buf, account->user_info, strlen(account->user_info) + 1);
-	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text));
-	gtk_text_buffer_set_text(buffer, buf, -1);
-	g_free(buf);
+
+	if ((user_info = gaim_account_get_user_info(account)) != NULL) {
+		buf = g_malloc(strlen(user_info) + 1);
+		strncpy_nohtml(buf, user_info, strlen(user_info) + 1);
+		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(b->text));
+		gtk_text_buffer_set_text(buffer, buf, -1);
+		g_free(buf);
+	}
+
 	gtk_container_add(GTK_CONTAINER(frame), b->text);
 	gtk_window_set_focus(GTK_WINDOW(b->window), b->text);