Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2005, 8:22:54 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: segfault-prevention

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/lib/gui/gui/gui_gtk.cc

    r4325 r4336  
    14191419{
    14201420  MenuItem* tmpItem = this->firstItem;
    1421   for (int i = 0; i<this->value; i++)
    1422     tmpItem = tmpItem->next;
    1423      
    1424   return tmpItem->name;
     1421  for (int i = 0; i < this->value; i++)
     1422    if (tmpItem)
     1423      tmpItem = tmpItem->next;
     1424    else
     1425      break;
     1426  if (tmpItem)
     1427    {
     1428      char* tmpName = new char[strlen(tmpItem->name)+1];
     1429      strcpy(tmpName, tmpItem->name);
     1430      return tmpName;
     1431    }
     1432  else
     1433    return NULL;
    14251434}
    14261435
     
    15031512
    15041513#endif /* HAVE_GTK2 */
    1505   PRINT(5)("%s set to: %d\n", this->title, this->value);
     1514  PRINT(1)("%s set to: %d\n", this->title, this->value);
    15061515}
    15071516
Note: See TracChangeset for help on using the changeset viewer.