diff --git a/libs/video/renderer/sw/sw_rpart.c b/libs/video/renderer/sw/sw_rpart.c index 1b0c2b5e1..52feecd42 100644 --- a/libs/video/renderer/sw/sw_rpart.c +++ b/libs/video/renderer/sw/sw_rpart.c @@ -67,7 +67,8 @@ R_ClearParticles (void) for (i = 0; i < r_maxparticles; i++) particles[i].next = &particles[i + 1]; - particles[r_maxparticles - 1].next = NULL; + if (r_maxparticles) + particles[r_maxparticles - 1].next = NULL; } void diff --git a/libs/video/renderer/sw32/sw32_rpart.c b/libs/video/renderer/sw32/sw32_rpart.c index 141c4a8ed..4530d07d6 100644 --- a/libs/video/renderer/sw32/sw32_rpart.c +++ b/libs/video/renderer/sw32/sw32_rpart.c @@ -67,7 +67,8 @@ R_ClearParticles (void) for (i = 0; i < r_maxparticles; i++) particles[i].next = &particles[i + 1]; - particles[r_maxparticles - 1].next = NULL; + if (r_maxparticles) + particles[r_maxparticles - 1].next = NULL; } void