Hi,

Regarding to the bug #858:
http://trac.subsurface-divelog.org/ticket/858

Please, see attached patch...
Question, should we print something in this case?

All the best,
Marcos
From 8cf432d8fc7fba53df9d174f37e6de8673dad5a4 Mon Sep 17 00:00:00 2001
From: Marcos CARDINOT <mcardi...@gmail.com>
Date: Fri, 20 Mar 2015 01:05:41 -0300
Subject: [PATCH] bugfix #858 - 'log' -> 're-plan dive' crashes subsurface

test case:
1 - make sure that you DO NOT have anything selected on the 'Dive list;
2 - in the menu bar, click on 'Log'->'Re-plan dive';
3 - crash!

Signed-off-by: Marcos CARDINOT <mcardi...@gmail.com>
---
 qt-ui/mainwindow.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 21d36d9..54c0ce7 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -584,9 +584,9 @@ void MainWindow::setupForAddAndPlan(const char *model)
 
 void MainWindow::on_actionReplanDive_triggered()
 {
-	if (!plannerStateClean())
+	if (!plannerStateClean() || !current_dive || !current_dive->dc.model)
 		return;
-	if (!current_dive || !current_dive->dc.model || strcmp(current_dive->dc.model, "planned dive")) {
+	else if (strcmp(current_dive->dc.model, "planned dive")) {
 		qDebug() << "trying to replan a dive that's not a planned dive:" << current_dive->dc.model;
 		return;
 	}
-- 
1.7.9.5

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to