mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Make SecureRandom non-failable
This commit is contained in:
parent
b010714426
commit
ec115ffe2a
@ -8669,7 +8669,7 @@ In multiplayer mode, the error may be arbitrarily large.
|
||||
|
||||
Interface for the operating system's crypto-secure PRNG.
|
||||
|
||||
It can be created via `SecureRandom()`. The constructor returns nil if a
|
||||
It can be created via `SecureRandom()`. The constructor throws an error if a
|
||||
secure random device cannot be found on the system.
|
||||
|
||||
### Methods
|
||||
|
@ -641,10 +641,9 @@ int LuaSecureRandom::create_object(lua_State *L)
|
||||
{
|
||||
LuaSecureRandom *o = new LuaSecureRandom();
|
||||
|
||||
// Fail and return nil if we can't securely fill the buffer
|
||||
if (!o->fillRandBuf()) {
|
||||
delete o;
|
||||
return 0;
|
||||
throw LuaError("SecureRandom: Failed to find secure random device on system");
|
||||
}
|
||||
|
||||
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
|
||||
|
Loading…
Reference in New Issue
Block a user