summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-04 09:38:29 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-12-04 18:34:03 +0100
commit03e87437e31fb134d77041f57d5d944daaf32225 (patch)
tree3f7f44b233106d4dfe8dccaea4daf8e803164b0a /core/dive.c
parentcab0699d4c50af126b84d637e5801ecb8cf26638 (diff)
downloadsubsurface-03e87437e31fb134d77041f57d5d944daaf32225.tar.gz
Gracefully handle deletion of a picture that doesn't exist
The list iteration in dive_remove_picture() was buggy and would crash if handled a picture that is not in the list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/dive.c b/core/dive.c
index 033139d0c..f37ad6272 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3841,9 +3841,9 @@ struct picture *clone_picture(struct picture *src)
void dive_remove_picture(char *filename)
{
struct picture **picture = &current_dive->picture_list;
- while (picture && !same_string((*picture)->filename, filename))
+ while (*picture && !same_string((*picture)->filename, filename))
picture = &(*picture)->next;
- if (picture) {
+ if (*picture) {
struct picture *temp = (*picture)->next;
picture_free(*picture);
*picture = temp;