[chronojump] Fixed crash when there are no forceSensor exercises	since last commits
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [chronojump] Fixed crash when there are no forceSensor exercises	since last commits
- Date: Thu, 24 Oct 2019 19:34:17 +0000 (UTC)
commit 883f335fdee3e38f33c4777df5e4eba362585f38
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Oct 24 21:33:58 2019 +0200
    Fixed crash when there are no forceSensor exercises since last commits
 src/gui/forceSensor.cs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 11cfc720..be2b2a61 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -2265,10 +2265,17 @@ LogB.Information(" fs R ");
 
        private void on_combo_force_sensor_exercise_changed (object o, EventArgs args)
        {
-               ForceSensorExercise fse = (ForceSensorExercise) SqliteForceSensorExercise.Select (
+               ArrayList array = SqliteForceSensorExercise.Select (
                                 false, getExerciseIDFromAnyCombo(
-                                       combo_force_sensor_exercise, forceSensorComboExercisesString, false), 
false )[0];
+                                       combo_force_sensor_exercise, forceSensorComboExercisesString, false), 
false );
+               if(array.Count == 0)
+               {
+                       button_force_sensor_stiffness.Label = "0";
+                       button_force_sensor_stiffness.Visible = false;
+                       return;
+               }
 
+               ForceSensorExercise fse = (ForceSensorExercise) array[0];
                if(fse.ComputeAsElastic)
                {
                        List<ForceSensorElasticBand> list_fseb = 
SqliteForceSensorElasticBand.SelectAll(false, true); //not opened, onlyActive
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]