[chronojump] Encoder: Fixed eventual crash on delete encoder set



commit 0de9fda12f1aaf5724988488192c1ac011d9cefa
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Sep 17 12:38:39 2018 +0200

    Encoder: Fixed eventual crash on delete encoder set

 src/gui/encoder.cs | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index dd21dde8..080e9bdf 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1868,13 +1868,17 @@ public partial class ChronoJumpWindow
                foreach(EncoderSignalCurve esc in linkedCurves) 
                {
                        //select related curves to find URL
-                       EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
+                       ArrayList array = SqliteEncoder.Select(
                                        false, esc.curveID, -1, -1, Constants.EncoderGI.ALL,
-                                       -1, "curve", EncoderSQL.Eccons.ALL, false, true)[0];
+                                       -1, "curve", EncoderSQL.Eccons.ALL, false, true);
 
-                       //delete file
-                       if(eSQL != null)
-                               Util.FileDelete(eSQL.GetFullURL(false));        //don't convertPathToR
+                       if (array != null && array.Count > 0)
+                       {
+                               EncoderSQL eSQL = (EncoderSQL) array[0];
+                               //delete file
+                               if(eSQL != null)
+                                       Util.FileDelete(eSQL.GetFullURL(false));        //don't convertPathToR
+                       }
 
                        //delete curve from encoder table
                        Sqlite.Delete(false, Constants.EncoderTable, esc.curveID);


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