mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Prevent dive_from_path from dereferencing invalid iter
This fixes a bug that Lubomir reported in a different way from the patch that he providede; I believe this to be more generic. Reported-by: "Lubomir I. Ivanov" <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7226a48a8c
commit
744b4e0c1c
1 changed files with 6 additions and 3 deletions
|
@ -166,9 +166,12 @@ static struct dive *dive_from_path(GtkTreePath *path)
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
gtk_tree_model_get_iter(MODEL(dive_list), &iter, path);
|
if (gtk_tree_model_get_iter(MODEL(dive_list), &iter, path)) {
|
||||||
gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
|
gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
|
||||||
return get_dive(idx);
|
return get_dive(idx);
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue