[epiphany] When the DataSource is empty, display empty file instead of crashing



commit f26d41a2e03e802f16c0f2693dad67f22b8b1edb
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Fri Sep 4 14:12:56 2009 -0300

    When the DataSource is empty, display empty file instead of crashing
    
    This is so that we don't crash when trying to view source for
    about:blank, and friends.

 src/window-commands.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index e2b8233..cefaa4c 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -690,7 +690,10 @@ save_temp_source_replace_cb (GFile *file, GAsyncResult *result, EphyEmbed *embed
 
 	/* We create a new GString here because we need to make sure
 	 * we keep writing in case of partial writes */
-	data = g_string_new_len (const_data->str, const_data->len);
+	if (const_data)
+		data = g_string_new_len (const_data->str, const_data->len);
+	else
+		data = g_string_new_len ("", 0);
 
 	g_output_stream_write_async (G_OUTPUT_STREAM (ostream),
 				     data->str, data->len,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]