[evince/gnome-2-28] [shell] Make sure total_num_bytes > 0 before using it in progress callbacks



commit 5f7049e7f1067ac8779adabcb018f7cbc3a51cfb
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Wed Oct 7 18:36:24 2009 +0200

    [shell] Make sure total_num_bytes > 0 before using it in progress callbacks
    
    Fixes bgo#597691

 shell/ev-window.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 9a77d70..e0e27c3 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1755,6 +1755,9 @@ window_open_file_copy_progress_cb (goffset   n_bytes,
 	if (!ev_window->priv->message_area)
 		return;
 
+	if (total_bytes <= 0)
+		return;
+
 	fraction = n_bytes / (gdouble)total_bytes;
 	status = g_strdup_printf (_("Downloading document (%d%%)"),
 				  (gint)(fraction * 100));
@@ -1937,7 +1940,10 @@ reload_remote_copy_progress_cb (goffset   n_bytes,
 	
 	if (!ev_window->priv->message_area)
 		return;
-	
+
+	if (total_bytes <= 0)
+		return;
+
 	fraction = n_bytes / (gdouble)total_bytes;
 	status = g_strdup_printf (_("Downloading document (%d%%)"),
 				  (gint)(fraction * 100));
@@ -2485,7 +2491,10 @@ window_save_file_copy_progress_cb (goffset n_bytes,
 	
 	if (!ev_window->priv->message_area)
 		return;
-	
+
+	if (total_bytes <= 0)
+		return;
+
 	fraction = n_bytes / (gdouble)total_bytes;
 	save_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dst), "save-type"));
 



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