[chronojump] Fixed crash on runEncoder on load signals that are not sprints



commit 314f3505d244c0ce838d332bc7d20ffdef525c89
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 1 12:39:35 2021 +0100

    Fixed crash on runEncoder on load signals that are not sprints

 src/gui/app1/runEncoder.cs | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 8b436163..7d22529f 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -1024,6 +1024,9 @@ public partial class ChronoJumpWindow
 
        private void raceEncoderCopyTempAndDoGraphs()
        {
+               // 0) delete results file
+               Util.FileDelete(RunEncoder.GetCSVResultsFileName());
+
                // 1) copy file
                File.Copy(lastRunEncoderFullPath, RunEncoder.GetCSVFileName(), true); //can be overwritten
 
@@ -1041,8 +1044,16 @@ public partial class ChronoJumpWindow
                treeview_raceAnalyzer = UtilGtk.RemoveColumns(treeview_raceAnalyzer);
 
                string contents = Util.ReadFile(RunEncoder.GetCSVResultsFileName(), false);
-               createTreeViewRaceEncoder(contents);
-               button_raceAnalyzer_table_save.Sensitive = true;
+
+               //maybe captured data was too low or two different than an sprint.
+               //then we have image but maybe we have no sprintResults.csv
+
+               if(contents == null || contents == "")
+                       return;
+               else {
+                       createTreeViewRaceEncoder(contents);
+                       button_raceAnalyzer_table_save.Sensitive = true;
+               }
        }
 
        private void raceEncoderCaptureGraphDo()


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