Fix Scrolling Textures Crash

This commit is contained in:
Prince Frizzy 2024-07-15 13:38:18 -04:00
parent 7ab8b7aaa0
commit ed0b8b177f
No known key found for this signature in database
GPG Key ID: 3859C9AA3D65EC54
1 changed files with 1 additions and 0 deletions

View File

@ -24,6 +24,7 @@ struct ScrollTarget *get_scroll_targets(u32 id, u16 size, u16 offset) {
if ((!scroll->hasOffset && offset > 0) || size < scroll->size) { if ((!scroll->hasOffset && offset > 0) || size < scroll->size) {
if (scroll->hasOffset) { return NULL; } if (scroll->hasOffset) { return NULL; }
if (size > scroll->size) { size = scroll->size; } // Don't use an invalid size if (size > scroll->size) { size = scroll->size; } // Don't use an invalid size
if (size + offset >= scroll->size) { return NULL; } // If the offset is invalid, Abort.
scroll->hasOffset = true; scroll->hasOffset = true;
Vtx* *newVtx = calloc(size, sizeof(Vtx*)); Vtx* *newVtx = calloc(size, sizeof(Vtx*));
if (!newVtx) { return NULL; } if (!newVtx) { return NULL; }