That's an even better fix...

/D

On Mon, Mar 16, 2015 at 08:23:35PM +0100, Robert Helling wrote:
> From 7555ca86055a95b5ca2595a4979d85de5e16464a Mon Sep 17 00:00:00 2001
> From: "Robert C. Helling" <[email protected]>
> Date: Mon, 2 Mar 2015 15:14:55 +0100
> Subject: [PATCH 1/3] When loading an image with geodata create a divesite when
>  the dive has none.
> 
> Signed-off-by: Robert C. Helling <[email protected]>
> ---
>  dive.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/dive.c b/dive.c
> index fc0fbb8..d449acd 100644
> --- a/dive.c
> +++ b/dive.c
> @@ -2927,8 +2927,12 @@ void dive_set_geodata_from_picture(struct dive *d, 
> struct picture *pic)
>  {
>       struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid);
>       if (!dive_site_has_gps_location(ds) && (pic->latitude.udeg || 
> pic->longitude.udeg)) {
> -             ds->latitude = pic->latitude;
> -             ds->longitude = pic->longitude;
> +             if (ds) {
> +                     ds->latitude = pic->latitude;
> +                     ds->longitude = pic->longitude;
> +             } else {
> +                     d->dive_site_uuid = create_dive_site_with_gps("", 
> pic->latitude, pic->longitude);
> +             }
>       }
>  }
>  
> -- 
> 1.9.3 (Apple Git-50)
> 

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to