ArraySort(): Fix bound checking bug.

Closes #31.
This commit is contained in:
Jordan Bancino 2024-05-18 10:50:18 -04:00
parent 5d87da31cd
commit 346b912a06
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View file

@ -267,8 +267,9 @@ ArrayQuickSort(Array * array, size_t low, size_t high, int (*compare) (void *, v
void
ArraySort(Array * array, int (*compare) (void *, void *))
{
if (!array)
if (!ArraySize(array))
{
// If a NULL ptr was given, or the array has no elements, do nothing.
return;
}
ArrayQuickSort(array, 0, array->size - 1, compare);