From: Csaba Halasz Date: Tue, 13 Oct 2009 15:56:06 +0000 (+0200) Subject: Do not pollute comm list by inserting not found elements in FGCommList::FindByPos X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f0d72b6b50a9d8795eb23c3c6ce81db3a5b555aa;p=flightgear.git Do not pollute comm list by inserting not found elements in FGCommList::FindByPos --- diff --git a/src/ATCDCL/commlist.cxx b/src/ATCDCL/commlist.cxx index 96baa9ad7..ef5c8d7b8 100644 --- a/src/ATCDCL/commlist.cxx +++ b/src/ATCDCL/commlist.cxx @@ -175,9 +175,10 @@ int FGCommList::FindByPos(const SGGeod& aPos, double range, comm_list_type* stat for ( int j=-by; j<=by; j++) { buck = sgBucketOffset(aPos.getLongitudeDeg(), aPos.getLatitudeDeg(), i, j); long int bucket = buck.gen_index(); - comm_list_type Fstations = commlist_bck[bucket]; - comm_list_iterator current = Fstations.begin(); - comm_list_iterator last = Fstations.end(); + comm_map_const_iterator Fstations = commlist_bck.find(bucket); + if (Fstations == commlist_bck.end()) continue; + comm_list_const_iterator current = Fstations->second.begin(); + comm_list_const_iterator last = Fstations->second.end(); // double az1, az2, s;