mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-15 19:59:53 +00:00
Merge pull request #14186 from JoshuaVandaele/dit-crash-fix
DITConfiguration: Prevent a crash if images fail to load
This commit is contained in:
commit
efa8439b79
@ -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)
|
||||
{
|
||||
|
||||
@ -45,9 +45,12 @@ void CopyImageRegion(const ImagePixelData& src, ImagePixelData& dst, const Rect&
|
||||
std::optional<ImagePixelData> LoadImage(const std::string& path)
|
||||
{
|
||||
File::IOFile file;
|
||||
file.Open(path, "rb");
|
||||
if (!file.Open(path, "rb"))
|
||||
return std::nullopt;
|
||||
|
||||
Common::UniqueBuffer<u8> buffer(file.GetSize());
|
||||
file.ReadBytes(buffer.data(), file.GetSize());
|
||||
if (!file.ReadBytes(buffer.data(), file.GetSize()))
|
||||
return std::nullopt;
|
||||
|
||||
ImagePixelData image;
|
||||
Common::UniqueBuffer<u8> data;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user