From: daveluff Date: Thu, 13 Feb 2003 12:17:37 +0000 (+0000) Subject: Better robustness for the ATCData structure istream operator. Adding fin.close(... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b271bc5da23a3f2fde03930a19fed026ccac4dd7;p=flightgear.git Better robustness for the ATCData structure istream operator. Adding fin.close() seems to have cured an intermittent stackdump when reading in the voice files which are the next istream operation to occur. Unknown types no longer cause the rest of the file not to be read - only the specific unknown entry --- diff --git a/src/ATC/commlist.cxx b/src/ATC/commlist.cxx index 17990558d..5494088a1 100644 --- a/src/ATC/commlist.cxx +++ b/src/ATC/commlist.cxx @@ -86,23 +86,25 @@ bool FGCommList::LoadComms(SGPath path) { ATCData a; fin >> a; if(a.type == INVALID) { - break; - } - - // Push all stations onto frequency map - commlist_freq[a.freq].push_back(a); - - // Push approach stations onto bucket map as well - if(a.type == APPROACH) { - // get bucket number - SGBucket bucket(a.lon, a.lat); - int bucknum = bucket.gen_index(); - commlist_bck[bucknum].push_back(a); + cout << "WARNING - INVALID type found in " << path.str() << '\n'; + } else { + // Push all stations onto frequency map + commlist_freq[a.freq].push_back(a); + + // Push approach stations onto bucket map as well + if(a.type == APPROACH) { + // get bucket number + SGBucket bucket(a.lon, a.lat); + int bucknum = bucket.gen_index(); + commlist_bck[bucknum].push_back(a); + } } - fin >> skipcomment; - } - return true; + fin >> skipcomment; + } + + fin.close(); + return true; }