mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	make sure to clear dives on dive split failure
The dive splitting code returns an error code when splitting fails, but
it turns out that the C++ UI code doesn't actually look at the error
code, and instead expected the resulting dives to be NULL if an error
happened and the split didn't succeed for whatever reason.
Which is kind of lazy of it, but we might as well clear the resulting
dives and make the UI code happy.  This should fix the problem that
Celia Marlowe reported on the Subsurface google groups forum.
Reported-by: Celia Marlowe
Acked-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Fixes: 145f70aab5 ("Undo: implement split-out of dive computer")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									88a9b8abf5
								
							
						
					
					
						commit
						606c3a0245
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -3596,8 +3596,6 @@ static int split_dive_at(const struct dive *dive, int a, int b, struct dive **ou | |||
| 	struct divecomputer *dc1, *dc2; | ||||
| 	struct event *event, **evp; | ||||
| 
 | ||||
| 	*out1 = *out2 = NULL; | ||||
| 
 | ||||
| 	/* if we can't find the dive in the dive list, don't bother */ | ||||
| 	if ((nr = get_divenr(dive)) < 0) | ||||
| 		return -1; | ||||
|  | @ -3727,6 +3725,7 @@ int split_dive(const struct dive *dive, struct dive **new1, struct dive **new2) | |||
| 	int at_surface, surface_start; | ||||
| 	const struct divecomputer *dc; | ||||
| 
 | ||||
| 	*new1 = *new2 = NULL; | ||||
| 	if (!dive) | ||||
| 		return -1; | ||||
| 
 | ||||
|  | @ -3768,6 +3767,7 @@ int split_dive_at_time(const struct dive *dive, duration_t time, struct dive **n | |||
| 	int i = 0; | ||||
| 	struct sample *sample = dive->dc.sample; | ||||
| 
 | ||||
| 	*new1 = *new2 = NULL; | ||||
| 	if (!dive) | ||||
| 		return -1; | ||||
| 	while(sample->time.seconds < time.seconds) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue