Merge pull request #747 from ajrhacker/options_bugfix

Avoid dereferencing null pointers in set_system_name (nw)
This commit is contained in:
Miodrag Milanović 2016-03-27 08:20:31 +02:00
commit 72d1fb813d

View File

@ -580,8 +580,8 @@ void emu_options::set_system_name(const char *name)
// look up the software part
machine_config config(*cursystem, *this);
software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str());
software_info *swinfo = swlist->find(sw_name.c_str());
software_part *swpart = swinfo->find_part(sw_part.c_str());
software_info *swinfo = swlist != nullptr ? swlist->find(sw_name.c_str()) : nullptr;
software_part *swpart = swinfo != nullptr ? swinfo->find_part(sw_part.c_str()) : nullptr;
// then add the options
if (new_system)