mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06:00
VideoCommon: when loading a PNG with no custom texture data levels already, create a level, this avoids a potential segfault
This commit is contained in:
@ -72,8 +72,11 @@ CustomAssetLibrary::LoadInfo DirectFilesystemAssetLibrary::LoadTexture(const Ass
|
||||
}
|
||||
else if (ext == ".png")
|
||||
{
|
||||
LoadPNGTexture(data, asset_path.string());
|
||||
if (data->m_levels.empty()) [[unlikely]]
|
||||
// If we have no levels, create one to pass into LoadPNGTexture
|
||||
if (data->m_levels.empty())
|
||||
data->m_levels.push_back({});
|
||||
|
||||
if (!LoadPNGTexture(&data->m_levels[0], asset_path.string()))
|
||||
return {};
|
||||
if (!LoadMips(asset_path, data))
|
||||
return {};
|
||||
|
Reference in New Issue
Block a user