fix: Texture interpreting raw data as structured images

This commit is contained in:
WerWolv 2024-01-08 09:39:01 +01:00
parent cab329556c
commit 9530100455
2 changed files with 6 additions and 2 deletions

View File

@ -46,7 +46,11 @@ namespace ImGuiExt {
if (size == 0)
return;
unsigned char *imageData = stbi_load_from_memory(buffer, size, &m_width, &m_height, nullptr, 4);
unsigned char *imageData = nullptr;
if (width == 0 || height == 0)
imageData = stbi_load_from_memory(buffer, size, &m_width, &m_height, nullptr, 4);
if (imageData == nullptr) {
if (width * height * 4 > size)
return;

View File

@ -341,7 +341,7 @@ namespace hex::init {
{ "Setting up environment", setupEnvironment, false },
{ "Creating directories", createDirectories, false },
{ "Loading settings", loadSettings, false },
{ "Loading plugins", loadPlugins, false },
{ "Loading plugins", loadPlugins, false },
};
}