mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
cab0699d4c
commit
03e87437e3
1 changed files with 2 additions and 2 deletions
|
@ -3841,9 +3841,9 @@ struct picture *clone_picture(struct picture *src)
|
||||||
void dive_remove_picture(char *filename)
|
void dive_remove_picture(char *filename)
|
||||||
{
|
{
|
||||||
struct picture **picture = ¤t_dive->picture_list;
|
struct picture **picture = ¤t_dive->picture_list;
|
||||||
while (picture && !same_string((*picture)->filename, filename))
|
while (*picture && !same_string((*picture)->filename, filename))
|
||||||
picture = &(*picture)->next;
|
picture = &(*picture)->next;
|
||||||
if (picture) {
|
if (*picture) {
|
||||||
struct picture *temp = (*picture)->next;
|
struct picture *temp = (*picture)->next;
|
||||||
picture_free(*picture);
|
picture_free(*picture);
|
||||||
*picture = temp;
|
*picture = temp;
|
||||||
|
|
Loading…
Add table
Reference in a new issue