diff options
author | 2017-08-06 21:01:11 +1000 | |
---|---|---|
committer | 2017-08-06 21:01:11 +1000 | |
commit | 9968fc71b08b2a27e930d02333cb813977a37cbd (patch) | |
tree | 0b381be91c5f02a9f3043d99d6ec8e75c38f6118 | |
parent | bda53fdc1fa94dbf7234aaf118441c60d0d0ab83 (diff) |
(nw) Fixed random crashing when swapping one slot device with another.
-rw-r--r-- | src/emu/emuopts.cpp | 17 | ||||
-rw-r--r-- | src/emu/emuopts.h | 2 | ||||
-rw-r--r-- | src/emu/image.cpp | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 11e369f0aca..5e69f8627ce 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -1022,6 +1022,23 @@ slot_option &emu_options::slot_option(const std::string &device_name) //------------------------------------------------- +// find_image_option +//------------------------------------------------- + +const image_option *emu_options::find_image_option(const std::string &device_name) const +{ + auto iter = m_image_options.find(device_name); + return iter != m_image_options.end() ? iter->second : nullptr; +} + +image_option *emu_options::find_image_option(const std::string &device_name) +{ + auto iter = m_image_options.find(device_name); + return iter != m_image_options.end() ? iter->second : nullptr; +} + + +//------------------------------------------------- // image_option //------------------------------------------------- diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 21df80b8a05..faec84bc1a2 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -478,6 +478,8 @@ public: bool has_slot_option(const std::string &device_name) const { return find_slot_option(device_name) ? true : false; } const ::image_option &image_option(const std::string &device_name) const; ::image_option &image_option(const std::string &device_name); + ::image_option *find_image_option(const std::string &device_name); + const ::image_option *find_image_option(const std::string &device_name) const; protected: virtual void command_argument_processed() override; diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 06ae645fb39..a9f5c0fa3b3 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -209,7 +209,7 @@ void image_manager::options_extract() } // and set the option (provided that it hasn't been removed out from under us) - if (machine().options().exists(image.instance_name())) + if (machine().options().find_image_option(image.instance_name())) machine().options().image_option(image.instance_name()).specify(std::move(image_opt)); } } |