From 218de5507fdcc51df893489d49d84c71bfe40ddc Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 19 Jan 2006 21:13:30 +0000 Subject: [PATCH] For values of less than 2, always return zero. Prevents errors when doing mod zero for example. --- src/xpdev/genwrap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c index c715812591..4770535815 100644 --- a/src/xpdev/genwrap.c +++ b/src/xpdev/genwrap.c @@ -275,9 +275,11 @@ unsigned DLLCALL xp_randomize(void) int DLLCALL xp_random(int n) { #ifdef HAS_RANDOM_FUNC + if(n<2) + return(0); return(random()%n); #else - float f; + float f=0; if(n<2) return(0); -- GitLab