summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-16 11:03:39 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-08-16 11:03:39 -0700
commit673cf274f8841686019827ff0f7c81d0f04f813b (patch)
treef12e69b6e239c328109199fb4db4580f35203312 /info.c
parent9b72217f79f29313d30c87c55f533cc606da6a8f (diff)
downloadsubsurface-673cf274f8841686019827ff0f7c81d0f04f813b.tar.gz
Avoid SIGSEGV when editing multiple dives
The multi-dive editing is broken if you right-click on the dive text-fields (instead of the divelist). This just avoids the SIGSEGV, it doesn't really fix the editing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/info.c b/info.c
index 1c7b6a9ac..6842d3d5b 100644
--- a/info.c
+++ b/info.c
@@ -470,13 +470,18 @@ int edit_multi_dive_info(int nr, int *indices)
success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
if (success)
for (i = 0; i < nr; i++) {
+ int idx = indices[i];
+ struct dive *n = get_dive(idx);
+
+ if (!n)
+ continue;
/* copy all "info" fields */
- save_dive_info_changes(get_dive(indices[i]), &info);
+ save_dive_info_changes(n, &info);
/* copy the cylinders / weightsystems */
- update_equipment_data(get_dive(indices[i]), dive);
+ update_equipment_data(n, dive);
/* this is extremely inefficient... it loops through all
dives to find the right one - but we KNOW the index already */
- flush_divelist(get_dive(indices[i]));
+ flush_divelist(n);
}
gtk_widget_destroy(dialog);