Skip to content

Commit

Permalink
Common: Fix bgfx crash when there is not enough RAM available
Browse files Browse the repository at this point in the history
  • Loading branch information
myst6re committed Nov 19, 2024
1 parent e814c15 commit 28ba54a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## Common

- Core: Fix bgfx crash when memory cannot be allocated ( https://github.com/julianxhokaxhiu/FFNx/pull/755 )
- Voice: Add support for `config.toml` configuration override based on Game Moment ID

## FF8
Expand Down
6 changes: 5 additions & 1 deletion src/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,11 @@ uint32_t Renderer::createTexture(uint8_t* data, size_t width, size_t height, int

if (copyData)
{
mem = bgfx::copy(data, texInfo.storageSize);
mem = bgfx::alloc(texInfo.storageSize);
// Protect from crashes
if (mem != NULL) {
bx::memCopy(mem->data, data, texInfo.storageSize);
}
}
else
{
Expand Down

0 comments on commit 28ba54a

Please sign in to comment.