Fixed RandomGenerator.random crashing if a nil 'self' is passed. (closes issue #1116)

It still doesn't generate a proper error message if a non-RandomGenerator 'self' is used, however.
This commit is contained in:
Alex Szpakowski
2016-01-02 21:15:39 -04:00
parent 46a2e7b85c
commit a9e10dcadf
+1 -1
View File
@@ -126,7 +126,7 @@ static FFI_RandomGenerator ffifuncs =
[](Proxy *p) -> double // random()
{
// FIXME: We need better type-checking...
if (!typeFlags[p->type][MATH_RANDOM_GENERATOR_ID])
if (p == nullptr || !typeFlags[p->type][MATH_RANDOM_GENERATOR_ID])
return 0.0;
RandomGenerator *rng = (RandomGenerator *) p->object;