summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-03 19:35:48 +0200
committerGitHub <noreply@github.com>2023-06-03 19:35:48 +0200
commit80bf175c48ea04739637b1ad6fda9716ae610635 (patch)
tree8e1f2e11fabd808d7fd419b55b30c209fdb49eca /Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp
parent0b3d28abaf2563b64a83acae82ace2f5149d2855 (diff)
parent47c40d51dffe646465bb5bb8454c6143005859da (diff)
Merge pull request #11879 from iwubcode/texture_data_load_nolevels
VideoCommon: avoid segfault when loading a PNG with no custom texture data levels
Diffstat (limited to 'Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp')
-rw-r--r--Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp
index 912def9e6b..f65ea9ccc9 100644
--- a/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp
+++ b/Source/Core/VideoCommon/Assets/DirectFilesystemAssetLibrary.cpp
@@ -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 {};