summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2007-10-16 01:09:04 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2007-10-16 01:09:04 +0000
commite55da3179e13eb361a8cd98af475bdbf5a6608bb (patch)
tree7dc2c801784e37dfb2b8469168d6911bb0f4fd90 /libgpsd_core.c
parent1e60d1fca0e0269083d439b6e5c9275dd21d118f (diff)
downloadgpsd-e55da3179e13eb361a8cd98af475bdbf5a6608bb.tar.gz
avoid a core dump if, somehow, the session goes NULL
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 694090e1..9e21d2d9 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -529,7 +529,12 @@ void gpsd_error_model(struct gps_device_t *session,
*/
#define UERE_NO_DGPS 8.0 /* meters, 95% confidence */
#define UERE_WITH_DGPS 2.0 /* meters, 95% confidence */
- double uere = (session->gpsdata.status == STATUS_DGPS_FIX ? UERE_WITH_DGPS : UERE_NO_DGPS);
+ double uere;
+
+ if (NULL == session)
+ return;
+
+ uere = (session->gpsdata.status == STATUS_DGPS_FIX ? UERE_WITH_DGPS : UERE_NO_DGPS);
/*
* Field reports match the theoretical prediction that