From b61cf93880d452a76caabad2112dda8ab441f456 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 16 Sep 2011 16:34:37 -0400 Subject: Add a sanoty check. --- cgps.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cgps.c') diff --git a/cgps.c b/cgps.c index 6f2eefab..b6be040f 100644 --- a/cgps.c +++ b/cgps.c @@ -632,12 +632,14 @@ static void update_gps_panel(struct gps_data_t *gpsdata) } (void)mvwprintw(datawin, 8, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr); - /* Fill in receiver type. */ - for (i = 0; i < gpsdata->devices.ndevices; i++) - if (strcmp(gpsdata->devices.list[i].path, gpsdata->dev.path) == 0) - break; - (void)snprintf(scr, sizeof(scr), "%s", gpsdata->devices.list[i].driver); - (void)mvwprintw(datawin, 9, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr); + if (gpsdata->set & DEVICELIST_SET) { + /* Fill in receiver type. */ + for (i = 0; i < gpsdata->devices.ndevices; i++) + if (strcmp(gpsdata->devices.list[i].path, gpsdata->dev.path) == 0) + break; + (void)snprintf(scr, sizeof(scr), "%s", gpsdata->devices.list[i].driver); + (void)mvwprintw(datawin, 9, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr); + } /* Note that the following fields are exceptions to the * sizing rule. The minimum window size does not include these * fields, if the window is too small, they get excluded. This -- cgit v1.2.1