1
0
Fork 0

puList.cxx: _list_box->getIntegerValue() returns -1 as long as no list

entry was selected. Return 0 in this case, not an invalid string address
  (causing segfaults).
dialogs.cxx: don't set property if no list entry was chosen.
This commit is contained in:
mfranz 2006-03-22 10:56:49 +00:00
parent 71c8889cbf
commit a04aad7a99
2 changed files with 5 additions and 2 deletions

View file

@ -304,7 +304,9 @@ copy_from_pui (puObject * object, SGPropertyNode * node)
// Special case to handle lists, as getStringValue cannot be overridden
if(object->getType() & PUCLASS_LIST)
{
node->setStringValue(((puList *) object)->getListStringValue());
const char *s = ((puList *) object)->getListStringValue();
if (s)
node->setStringValue(s);
}
else
{

View file

@ -79,7 +79,8 @@ puList::newList (char ** contents)
char *
puList::getListStringValue ()
{
return _contents[_list_box->getIntegerValue()];
int i = _list_box->getIntegerValue();
return i < 0 ? 0 : _contents[i];
}
int