diff options
author | Bill Meier <wmeier@newsguy.com> | 2007-05-24 16:18:33 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2007-05-24 16:18:33 +0000 |
commit | eb61e72efdeecae2234019b125b66dc0c39b3ae3 (patch) | |
tree | f8c4e288c5f04eaf9a7405c076cb01f6f90b1a45 /gtk/ansi_map_stat.c | |
parent | 3ecba488981ce35f44be79c9a03622afee2ff70e (diff) | |
download | wireshark-eb61e72efdeecae2234019b125b66dc0c39b3ae3.tar.gz wireshark-eb61e72efdeecae2234019b125b66dc0c39b3ae3.tar.bz2 wireshark-eb61e72efdeecae2234019b125b66dc0c39b3ae3.zip |
When computing average: use 0 as avg if divisor=0
svn path=/trunk/; revision=21922
Diffstat (limited to 'gtk/ansi_map_stat.c')
-rw-r--r-- | gtk/ansi_map_stat.c | 8 |
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); |