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:
parent
71c8889cbf
commit
a04aad7a99
2 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue