[chronojump] Fixed a crash on creating/editing session with same name when no session loaded



commit 817aa6a3bed5147a304f65ee07f7cbca57ed1e44
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Aug 31 23:02:19 2020 +0100

    Fixed a crash on creating/editing session with same name when no session loaded

 src/gui/app1/session/addEdit.cs | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/app1/session/addEdit.cs b/src/gui/app1/session/addEdit.cs
index b2574d38..c15f8d4e 100644
--- a/src/gui/app1/session/addEdit.cs
+++ b/src/gui/app1/session/addEdit.cs
@@ -618,12 +618,22 @@ public partial class ChronoJumpWindow
                LogB.Information("app1sae_on_button_accept_clicked 1");
 
                bool sessionNameExists = Sqlite.Exists (false, Constants.SessionTable, name);
-               if(sessionNameExists && name != currentSession.Name )
+               if(sessionNameExists && app1sae_addSession)
                {
-                       LogB.Information("app1sae_on_button_accept_clicked 2");
+                       //if we try to add a new session with same name ...
+                       LogB.Information("app1sae_on_button_accept_clicked add existing ...");
                        string myString = string.Format(Catalog.GetString("Session: '{0}' exists. Please, use 
another name"), name);
                        ErrorWindow.Show(myString);
-                       LogB.Information("app1sae_on_button_accept_clicked 3");
+                       LogB.Information("app1sae_on_button_accept_clicked add existing done!");
+               }
+               else if( sessionNameExists && ! app1sae_addSession && (currentSession == null || name != 
currentSession.Name) )
+               {
+                       //if we edit a session but we changed name and it matches another existing session ...
+                       LogB.Information("app1sae_on_button_accept_clicked edit existing not me ...");
+                       string myString = string.Format(Catalog.GetString("Session: '{0}' exists. Please, use 
another name"), name);
+                       ErrorWindow.Show(myString);
+                       LogB.Information("app1sae_on_button_accept_clicked edit existing not me done!");
+
                } else {
                        LogB.Information("app1sae_on_button_accept_clicked 4");
                        int sportID;


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