[chronojump] Fixed call to fillTreeView reaction_times, pulses, multi_chronopic when no session



commit 44b5da0b9c50804025571495dd43030fad435c14
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Apr 2 16:26:14 2019 +0200

    Fixed call to fillTreeView reaction_times, pulses, multi_chronopic when no session

 src/gui/chronojump.cs | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0b6659c1..c56bec54 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1607,7 +1607,12 @@ public partial class ChronoJumpWindow
        private void fillTreeView_reaction_times (string filter) {
                fillTreeView_reaction_times (filter, false);
        }
-       private void fillTreeView_reaction_times (string filter, bool dbconOpened) {
+       private void fillTreeView_reaction_times (string filter, bool dbconOpened)
+       {
+               //do not crash if arrive here with no session
+               if(currentSession == null)
+                       return;
+
                string [] myRTs = SqliteReactionTime.SelectReactionTimes(dbconOpened, 
currentSession.UniqueID, -1, "", 
                                Sqlite.Orders_by.DEFAULT, -1);
 
@@ -1690,7 +1695,12 @@ public partial class ChronoJumpWindow
        private void fillTreeView_pulses (string filter) {
                fillTreeView_pulses (filter, false);
        }
-       private void fillTreeView_pulses (string filter, bool dbconOpened) {
+       private void fillTreeView_pulses (string filter, bool dbconOpened)
+       {
+               //do not crash if arrive here with no session
+               if(currentSession == null)
+                       return;
+
                string [] myPulses = SqlitePulse.SelectPulses(dbconOpened, currentSession.UniqueID, -1);
                myTreeViewPulses.Fill(myPulses, filter);
                expandOrMinimizeTreeView((TreeViewEvent) myTreeViewPulses, treeview_pulses);
@@ -1785,7 +1795,12 @@ public partial class ChronoJumpWindow
        private void fillTreeView_multi_chronopic () {
                fillTreeView_multi_chronopic (false);
        }
-       private void fillTreeView_multi_chronopic (bool dbconOpened) {
+       private void fillTreeView_multi_chronopic (bool dbconOpened)
+       {
+               //do not crash if arrive here with no session
+               if(currentSession == null)
+                       return;
+
                string [] mcs = SqliteMultiChronopic.SelectTests(dbconOpened, currentSession.UniqueID, -1);
                myTreeViewMultiChronopic.Fill(mcs, "");
                expandOrMinimizeTreeView((TreeViewEvent) myTreeViewMultiChronopic, treeview_multi_chronopic);


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