1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-07-03 02:23:20 +00:00

Fix NPE when pulling an event with no type

I assume people have broken coroutine dispatchers - I didn't think it
was possible to queue an actual event with no type.

See cc-tweaked/cc-restitched#31. Will fix it too once merged downstream!
This commit is contained in:
Jonathan Coates 2021-12-08 22:45:23 +00:00
parent 3eab2a9b57
commit 47ad7a35dc
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -98,7 +98,10 @@ public static MethodResult pullEvent( @Nullable String filter, @Nonnull ILuaCall
{
Objects.requireNonNull( callback, "callback cannot be null" );
return new MethodResult( new Object[] { filter }, results -> {
if( results.length >= 1 && results[0].equals( "terminate" ) ) throw new LuaException( "Terminated", 0 );
if( results.length >= 1 && Objects.equals( results[0], "terminate" ) )
{
throw new LuaException( "Terminated", 0 );
}
return callback.resume( results );
} );
}