[chronojump] Safer save 1RM



commit c8c1aae55e44762a9060a87f52896adcf821fe6f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun May 15 00:58:54 2016 +0200

    Safer save 1RM

 src/gui/encoder.cs |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index cd339b6..1953084 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3096,7 +3096,17 @@ public partial class ChronoJumpWindow
                }
 
                string [] load1RMStr = contents.Split(new char[] {';'});
-               double load1RM = Convert.ToDouble(Util.ChangeDecimalSeparator(load1RMStr[1]));
+               string load1RMtemp = Util.ChangeDecimalSeparator(load1RMStr[1]);
+               
+               //check if it's a number
+               if(! Util.IsNumber(load1RMtemp, true)) {
+                       new DialogMessage(Constants.MessageTypes.WARNING, 
+                                       Catalog.GetString("Error doing operation.") + "\n" +
+                                       Catalog.GetString("Operation cancelled."));
+                       return;
+               }
+
+               double load1RM = Convert.ToDouble(load1RMtemp);
 
                if(load1RM == -1) {
                        new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Not enough 
data."));


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