diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index 6d9dafe19..d09d572e9 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -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 { diff --git a/src/GUI/puList.cxx b/src/GUI/puList.cxx index 5902a68ca..b99ccd405 100644 --- a/src/GUI/puList.cxx +++ b/src/GUI/puList.cxx @@ -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