[PATCH] info.c: Make sure we only edit when there is dive selection

Lubomir I. Ivanov neolit123 at gmail.com
Tue Oct 23 07:02:14 PDT 2012


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

info.c: always check for "amount_selected > 0" before calling
edit_multi_dive_info().

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 info.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/info.c b/info.c
index 8380135..8b8ecb5 100644
--- a/info.c
+++ b/info.c
@@ -226,7 +226,8 @@ static int delete_dive_info(struct dive *dive)
 
 static void info_menu_edit_cb(GtkMenuItem *menuitem, gpointer user_data)
 {
-	edit_multi_dive_info(NULL);
+	if (amount_selected)
+		edit_multi_dive_info(NULL);
 }
 
 static void info_menu_delete_cb(GtkMenuItem *menuitem, gpointer user_data)
@@ -769,7 +770,7 @@ int edit_multi_dive_info(struct dive *single_dive)
 
 int edit_dive_info(struct dive *dive)
 {
-	if (!dive)
+	if (!dive || !amount_selected)
 		return 0;
 	return edit_multi_dive_info(dive);
 }
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list