g_snprintf(buf,4,"%03d", vtl->highest_wp_number );
/* search down until we find something that *does* exist */
- while ( vtl->highest_wp_number >= 0 && ! g_hash_table_lookup ( vtl->waypoints, buf ) ) {
+ while ( vtl->highest_wp_number > 0 && ! g_hash_table_lookup ( vtl->waypoints, buf ) ) {
vtl->highest_wp_number --;
g_snprintf(buf,4,"%03d", vtl->highest_wp_number );
}
{
gchar buf[4];
if ( vtl->highest_wp_number < 0 || vtl->highest_wp_number >= 999 )
- return "";
+ return NULL;
g_snprintf(buf,4,"%03d", vtl->highest_wp_number+1 );
return g_strdup(buf);
}