mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-02-13 16:00:27 -05:00
DITConfiguration: Prevent a crash if images fail to load
Recently came across a strange issue where Dolphin would hard crash in most games with this error: ```sh /usr/include/c++/15.2.1/optional:1165: constexpr const _Tp* std::optional<_Tp>::operator->() const [with _Tp = InputCommon::ImagePixelData]: Assertion 'this->_M_is_engaged()' failed. ``` The culprit turned out to be accessing `host_key_image` which is an `std::optional` thay may return `std::nullopt`. I'm not sure why this issue started occuring for me since I've had no issue with my Dynamic Input Textures in the past? But this fixes a crash if the image fails to load.
This commit is contained in:
@@ -150,7 +150,15 @@ void Configuration::GenerateTexture(const Common::IniFile& file,
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto host_key_image = LoadImage(m_base_path + input_image_iter->second);
|
||||
const std::string full_image_path = m_base_path + input_image_iter->second;
|
||||
const auto host_key_image = LoadImage(full_image_path);
|
||||
if (!host_key_image)
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO,
|
||||
"Failed to load image '{}' needed for dynamic input texture generation",
|
||||
full_image_path);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const auto& rect : rects)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user