Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/rand.c')
-rw-r--r--source/blender/blenlib/intern/rand.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 28dc5a696d5..6114ffdda80 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -111,7 +111,13 @@ float rng_getFloat(RNG *rng)
void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
{
int i = numElems;
- void *temp = malloc(elemSize);
+ void *temp;
+
+ if (numElems <= 0) {
+ return;
+ }
+
+ temp = malloc(elemSize);
while (--i) {
int j = rng_getInt(rng)%numElems;