mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user