[sysprof] callgraph: fix potential divide-by-zero



commit 4cb42d2f23089f2f10b773332558d79533b5a74a
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 9 21:47:10 2017 -0700

    callgraph: fix potential divide-by-zero

 lib/sp-callgraph-view.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/sp-callgraph-view.c b/lib/sp-callgraph-view.c
index 8ea1683..88b05ee 100644
--- a/lib/sp-callgraph-view.c
+++ b/lib/sp-callgraph-view.c
@@ -474,7 +474,7 @@ sp_callgraph_view_function_selection_changed (SpCallgraphView  *self,
     gpointer key, value;
     guint size = 0;
 
-    size = sp_callgraph_view_get_profile_size (self);
+    size = MAX (1, sp_callgraph_view_get_profile_size (self));
 
     g_hash_table_iter_init (&hiter, callers);
 
@@ -924,7 +924,7 @@ append_to_tree_and_free (SpCallgraphView *self,
   g_assert (GTK_IS_TREE_STORE (store));
   g_assert (item != NULL);
 
-  profile_size = sp_callgraph_view_get_profile_size (self);
+  profile_size = MAX (1, sp_callgraph_view_get_profile_size (self));
 
   gtk_tree_store_append (store, &iter, parent);
 


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