Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 7, 2005, 1:58:39 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: ini_parser safer now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/parser/ini_parser/ini_parser.cc

    r5952 r5953  
    125125  FILE*    stream;           //< The stream we use to read the file.
    126126  int      lineCount = 0;    //< The Count of lines.
    127 
    128127
    129128  if (this->fileName != NULL)
     
    448447  {
    449448    std::list<IniEntry>::const_iterator entry = this->getEntryIT(entryName, sectionName);
    450     if (!strcmp((*entry).name, entryName))
     449    if (entry != NULL &&  !strcmp((*entry).name, entryName))
    451450      return (*entry).value;
    452451    PRINTF(2)("Entry '%s' in section '%s' not found.\n", entryName, sectionName);
     
    618617      if (!strcmp((*entry).name, entryName))
    619618        break;
    620   return entry;
     619  if (entry == (*section).entries.end())
     620    return NULL;
     621  else
     622    return entry;
    621623}
    622624
     
    638640      if (!strcmp((*entry).name, entryName))
    639641        break;
    640   return entry;
     642  if (entry == (*section).entries.end())
     643    return NULL;
     644  else
     645    return entry;
    641646}
    642647
Note: See TracChangeset for help on using the changeset viewer.