diff libpurple/plugins/log_reader.c @ 20332:3a9709bfde65

applied changes from 4d50bf3b08569aa2108a9f5da47fb1548d0c7dd9 through 525a410c03e7e16535f3fe683f9651283109265d applied changes from 525a410c03e7e16535f3fe683f9651283109265d through d4b316d73ebaf93803ca2642e78b8821c3b5d5c7
author Luke Schierer <lschiere@pidgin.im>
date Fri, 19 Oct 2007 18:27:12 +0000
parents 24ce4fcce5b0
children d4cdca890d8e 8de7c44fd577
line wrap: on
line diff
--- a/libpurple/plugins/log_reader.c	Fri Oct 19 18:24:58 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Fri Oct 19 18:27:12 2007 +0000
@@ -1939,13 +1939,11 @@
 	g_return_val_if_fail(data->path != NULL, g_strdup(""));
 	g_return_val_if_fail(data->length > 0, g_strdup(""));
 
-	error = NULL;
-	
-	contents = g_malloc(data->length + 2);
-
 	file = g_fopen(data->path, "rb");
 	g_return_val_if_fail(file != NULL, g_strdup(""));
-	
+
+	contents = g_malloc(data->length + 2);
+
 	fseek(file, data->offset, SEEK_SET);
 	fread(contents, data->length, 1, file);
 	fclose(file);
@@ -2026,7 +2024,7 @@
 					g_string_append(formatted, "</font> ");
 
 					if (is_in_message) {
-						if (buddy_name != NULL && buddy->alias) {
+						if (buddy_name != NULL && buddy != NULL && buddy->alias) {
 							g_string_append_printf(formatted,
 								"<span style=\"color: #A82F2F;\">"
 								"<b>%s</b></span>: ", buddy->alias);
@@ -2056,7 +2054,9 @@
 				g_string_append(formatted, line);
 				g_string_append(formatted, "<br>");
 			}
-			line = ++c;
+
+			if (c)
+				line = ++c;
 		}
 	}
 	g_free(contents);