aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2007-05-24 16:18:33 +0000
committerBill Meier <wmeier@newsguy.com>2007-05-24 16:18:33 +0000
commiteb61e72efdeecae2234019b125b66dc0c39b3ae3 (patch)
treef8c4e288c5f04eaf9a7405c076cb01f6f90b1a45 /gtk
parent3ecba488981ce35f44be79c9a03622afee2ff70e (diff)
When computing average: use 0 as avg if divisor=0
svn path=/trunk/; revision=21922
Diffstat (limited to 'gtk')
-rw-r--r--gtk/ansi_map_stat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gtk/ansi_map_stat.c b/gtk/ansi_map_stat.c
index ecd54d3162..8c992f8697 100644
--- a/gtk/ansi_map_stat.c
+++ b/gtk/ansi_map_stat.c
@@ -138,6 +138,7 @@ ansi_map_stat_draw(
ansi_map_stat_t *stat_p = tapdata;
int i, j;
char *strp;
+ double avg;
if (dlg.win && tapdata)
{
@@ -156,7 +157,12 @@ ansi_map_stat_draw(
gtk_clist_set_text(GTK_CLIST(dlg.table), j, 3, strp);
g_free(strp);
- strp = g_strdup_printf("%.2f", stat_p->size[ansi_map_opr_code_strings[i].value]/stat_p->message_type[ansi_map_opr_code_strings[i].value]);
+ avg = 0.0;
+ if (stat_p->message_type[ansi_map_opr_code_strings[i].value] !=0 )
+ {
+ avg = stat_p->size[ansi_map_opr_code_strings[i].value]/stat_p->message_type[ansi_map_opr_code_strings[i].value];
+ }
+ strp = g_strdup_printf("%.2f", avg);
gtk_clist_set_text(GTK_CLIST(dlg.table), j, 4, strp);
g_free(strp);