Skip to content

Commit

Permalink
Use of bsearch_ext() failed with a NULL result (i.e., if an MPC code …
Browse files Browse the repository at this point in the history
…wasn't found). Easily fixed.
  • Loading branch information
Bill-Gray committed Jan 5, 2024
1 parent aacbd05 commit bd28498
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mpc_obs.cpp
Expand Up @@ -824,8 +824,12 @@ int get_observer_data( const char FAR *mpc_code, char *buff, mpc_code_t *cinfo)
}

if( !curr_station || mpc_code_cmp( &curr_station, &mpc_code))
curr_station = *(char **)bsearch_ext( &mpc_code, station_data, n_stations,
{
char **search = (char **)bsearch_ext( &mpc_code, station_data, n_stations,
sizeof( char *), mpc_code_cmp, NULL);

curr_station = (search ? *search : NULL);
}
if( !curr_station)
{
const char *envar = "UPDATE_OBSCODES_HTML";
Expand Down

0 comments on commit bd28498

Please sign in to comment.