Skip to content

Commit

Permalink
Don't sort if there's nothing to do (prevents array underflow, too).
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 7, 2012
1 parent 4d9f253 commit 5c18db7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/physfs.c
Expand Up @@ -657,7 +657,8 @@ void __PHYSFS_sort(void *entries, size_t max,
* Quicksort w/ Bubblesort fallback algorithm inspired by code from here:
* http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html
*/
__PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
if (max > 0)
__PHYSFS_quick_sort(entries, 0, max - 1, cmpfn, swapfn);
} /* __PHYSFS_sort */


Expand Down

0 comments on commit 5c18db7

Please sign in to comment.