summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-07-29 04:23:45 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-07-29 04:23:45 +0000
commitb928cb15077f4e5e83bd8f3312002e5cd7a21f45 (patch)
tree442ef7dc590f9ebf13f0298ada2c7d1c81db1814
parent16b69641a6c842379324c991054b58c40670aa23 (diff)
downloadgpsd-b928cb15077f4e5e83bd8f3312002e5cd7a21f45.tar.gz
Prevent a core dump when we get a device assigned but don't know its type yet.
-rw-r--r--gpsd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gpsd.c b/gpsd.c
index c714bc6c..6030be47 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -631,7 +631,7 @@ static int handle_gpsd_request(int cfd, char *buf, int buflen)
(void)snprintf(phrase, sizeof(phrase), ",M=%d", whoami->device->gpsdata.fix.mode);
break;
case 'N':
- if (!assign_channel(whoami))
+ if (!assign_channel(whoami) || whoami->device->device_type == NULL)
(void)strcpy(phrase, ",N=?");
else if (!whoami->device->device_type->mode_switcher)
(void)strcpy(phrase, ",N=0");