[chronojump] Fixes crash that happened when the user Import a Chronojump session without any open session.



commit c637b2f5c6fc5647ffbc27df3f1e49040acdf6aa
Author: Carles Pina i Estany <carles pina cat>
Date:   Fri Oct 7 16:54:20 2016 +0200

    Fixes crash that happened when the user Import a Chronojump session without any open session.
    
    If the user had a session open the crash didn't happen (currentSession
    is valid in the changed code).

 src/gui/chronojump.cs |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 9880bdd..fca6f88 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1329,6 +1329,14 @@ public partial class ChronoJumpWindow
        private void fillTreeView_jumps (string filter, bool dbconOpened) {
                string [] myJumps;
        
+               if (currentSession == null) {
+                       // This happens when the user "Imports a session": Chronojump tries to
+                       // update comboboxes, it reaches here because the comboboxes are updated and
+                       // on_combo_result_jumps_changedd. But if the user didn't have any
+                       // open session currentSession variable (see below) is null and it crashed here
+                       // (when it did currentSession.UniqueID with currentSession==null)
+                       return;
+               }
                myJumps = SqliteJump.SelectJumps(dbconOpened, currentSession.UniqueID, -1, "", "",
                                Sqlite.Orders_by.DEFAULT, -1);
 


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