Bug: create new trip above with single dive

Dirk Hohndel dirk at hohndel.org
Tue Sep 18 16:23:51 PDT 2012


Henrik Brautaset Aronsen <subsurface at henrik.synth.no> writes:

> Den 18.09.12 22:47, skrev Lubomir I. Ivanov:
>> On 18 September 2012 22:38, Henrik Brautaset Aronsen
>> <subsurface at henrik.synth.no> wrote:
>>> Yup, I get that one as well.  Stacktrace:
>>>
>>> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>>> 0   libgtk-quartz-2.0.0.dylib           0x000000010e4bd2a7
>>> gtk_tree_model_get_valist + 407
>>> 1   libgtk-quartz-2.0.0.dylib           0x000000010e4bd0ef
>>> gtk_tree_model_get + 319
>>> 2   subsurface                          0x000000010e009c2f dive_from_path +
>> henrik,
>>
>> you can try:
>> [PATCH] Handle a special case when creating a new trip from the last dive
>>
>> not sure if that will solve it, though.
>
> Yup, that worked.

Please also check the patch that I sent out a minute ago. That's the one
I'm planning to push instead of Lubomir's.

diff --git a/divelist.c b/divelist.c
index aedcdf0..fb076a8 100644
--- a/divelist.c
+++ b/divelist.c
@@ -166,9 +166,12 @@ static struct dive *dive_from_path(GtkTreePath *path)
        GtkTreeIter iter;
        int idx;
 
-       gtk_tree_model_get_iter(MODEL(dive_list), &iter, path);
-       gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
-       return get_dive(idx);
+       if (gtk_tree_model_get_iter(MODEL(dive_list), &iter, path)) {
+               gtk_tree_model_get(MODEL(dive_list), &iter, DIVE_INDEX, &idx, -1);
+               return get_dive(idx);
+       } else {
+               return NULL;
+       }
 
 }
 


Thanks

/D


More information about the subsurface mailing list