From a11578c1abb7df132bb36847a95719315b926901 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Date: Sun, 7 Jun 2015 07:55:53 -0300
Subject: [PATCH 3/8] Temporary Dive + Temporary Site = Crash

We always tougth that a dive had a dive site
and that a dive really exists. but if we go
to add dive and then go to add dive site,
none of those exists yet and then we got a crash.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
---
 dive.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dive.h b/dive.h
index 9a26892..57e1b78 100644
--- a/dive.h
+++ b/dive.h
@@ -624,6 +624,8 @@ static inline bool dive_site_has_gps_location(struct dive_site *ds)
 
 static inline int dive_has_gps_location(struct dive *dive)
 {
+	if (!dive)
+		return NULL;
 	return dive_site_has_gps_location(get_dive_site_by_uuid(dive->dive_site_uuid));
 }
 
-- 
2.3.2 (Apple Git-55)

