From c97f5aceb456350c1549ddd6254c2d2edb88220a Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Sat, 22 Sep 2018 15:35:35 -0700 Subject: cgps: fix sta view for small number of sats. --- cgps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cgps.c') diff --git a/cgps.c b/cgps.c index ed97a869..eba03434 100644 --- a/cgps.c +++ b/cgps.c @@ -545,11 +545,13 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message) if (gpsdata->satellites_visible != 0) { int sat_no; + int loop_end = (display_sats < gpsdata->satellites_visible) ? \ + display_sats : gpsdata->satellites_visible; qsort( gpsdata->skyview, gpsdata->satellites_visible, sizeof( struct satellite_t), sat_cmp); /* displayed all sats that fit, maybe all of them */ - for (sat_no = 0; sat_no <= display_sats; sat_no++) { + for (sat_no = 0; sat_no < loop_end; sat_no++) { int column = 1; /* column to write to */ char *gnssid; -- cgit v1.2.1