[gnome-software] trivial: Fix a potential div-by-zero when installing snap packages



commit 5258e8d1f06a15ecbfe0df285bad9457b3519b46
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 18 10:10:24 2016 +0100

    trivial: Fix a potential div-by-zero when installing snap packages
    
    Found with clang...

 src/plugins/gs-plugin-snap.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-snap.c b/src/plugins/gs-plugin-snap.c
index 766a602..0104104 100644
--- a/src/plugins/gs-plugin-snap.c
+++ b/src/plugins/gs-plugin-snap.c
@@ -568,7 +568,8 @@ send_package_action (GsPlugin *plugin,
                                total += task_total;
                        }
 
-                       gs_app_set_progress (app, 100 * done / total);
+                       if (total > 0)
+                               gs_app_set_progress (app, 100 * done / total);
 
                        g_list_free (task_list);
                }


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