diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2018-10-14 08:20:59 +0200 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-10-14 09:22:56 +0200 |
commit | ac9bab7e2fdc08a3ce691a2c7035e315ec3d8ff2 (patch) | |
tree | 3f4330cfe8867af0ff8b1ea4191dd5b3dd5a429e /core | |
parent | 068b01aef203ee12c2d538141621c8ab5b13f0c8 (diff) | |
download | subsurface-ac9bab7e2fdc08a3ce691a2c7035e315ec3d8ff2.tar.gz |
Autogroup only when selected
Comits f427226b3b and 43c3885249f of the undo series introduced 2 calls
of autogroup_dives() without checking the autogroup global boolean.
This is a bug. An import from DC (for example) then triggers an
autogrouping, the divelist is autogrouped, and the UI button
is off.
This commit solves this. I've chosen for a guard in the autogroup_dives()
that now is a no-op when called when the user did not select autogrouping.
In additon, simplified the other calls to this function, as we do
not need to check before calling any more.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core')
-rw-r--r-- | core/divelist.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/divelist.c b/core/divelist.c index d67f7935f..ad851ecc8 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1023,7 +1023,8 @@ dive_trip_t *get_dives_to_autogroup(int start, int *from, int *to, bool *allocat } /* - * Walk the dives from the oldest dive, and see if we can autogroup them + * Walk the dives from the oldest dive, and see if we can autogroup them. + * But only do this when the user selected autogrouping. */ void autogroup_dives(void) { @@ -1032,6 +1033,9 @@ void autogroup_dives(void) int i, j; bool alloc; + if (!autogroup) + return; + for(i = 0; (trip = get_dives_to_autogroup(i, &from, &to, &alloc)) != NULL; i = to) { /* If this was newly allocated, add trip to list */ if (alloc) |