aboutsummaryrefslogtreecommitdiff
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2016-08-07 10:46:03 +0200
committerGitHub <noreply@github.com>2016-08-07 10:46:03 +0200
commit46248b0922846e4beb386c5cf8fc12ebd3219b72 (patch)
tree626f274af1edf2ccdbdb7fe2d307c96491dbc02f /src/rlgl.c
parent306945fe147ea7742880635e77a5c2656f6e1fdc (diff)
parent47b6e627449187f5385e9beafeda3b8517faae26 (diff)
downloadraylib-46248b0922846e4beb386c5cf8fc12ebd3219b72.tar.gz
raylib-46248b0922846e4beb386c5cf8fc12ebd3219b72.zip
Merge pull request #175 from ghassanpl/develop
More fixes for Lua
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index d027495f..6fb4bf3d 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -2559,11 +2559,13 @@ void DestroyLight(Light light)
{
if (light != NULL)
{
+ int light_id = light->id;
+
// Free dynamic memory allocation
- free(lights[light->id]);
+ free(lights[light_id]);
// Remove *obj from the pointers array
- for (int i = light->id; i < lightsCount; i++)
+ for (int i = light_id; i < lightsCount; i++)
{
// Resort all the following pointers of the array
if ((i + 1) < lightsCount)
@@ -2571,7 +2573,6 @@ void DestroyLight(Light light)
lights[i] = lights[i + 1];
lights[i]->id = lights[i + 1]->id;
}
- else free(lights[i]);
}
// Decrease enabled physic objects count