[smuxi/stable] Frontend-GNOME: fix another Gtk-CRITICAL message (refs: #826)



commit 2394320b2af82f2709e673071f28433a00402779
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Feb 23 14:55:39 2016 +0100

    Frontend-GNOME: fix another Gtk-CRITICAL message (refs: #826)
    
    Removing the last chat will lead to an infinity fraction since x / 0d is
    Infinity with Double as data type.

 src/Frontend-GNOME/MainWindow.cs |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/MainWindow.cs b/src/Frontend-GNOME/MainWindow.cs
index 95c1fc4..8a7b736 100644
--- a/src/Frontend-GNOME/MainWindow.cs
+++ b/src/Frontend-GNOME/MainWindow.cs
@@ -654,6 +654,10 @@ namespace Smuxi.Frontend.Gnome
             } else if (fraction > 1) {
                 fraction = 1;
             }
+            if (totalChatCount == 0) {
+                // x / 0d -> Infinity
+                fraction = 0;
+            }
             ProgressBar.Fraction = fraction;
             ProgressBar.Text = String.Format("{0} / {1}",
                                               syncedChatCount,


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