ScriptVM: Catch exceptions thrown from a JavaScriptCallback
These shouldn't crash the client
This commit is contained in:
@@ -118,8 +118,15 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
{
|
{
|
||||||
Object[] arguments = event.getArguments();
|
Object[] arguments = event.getArguments();
|
||||||
if (arguments != null && arguments.length > 0 && arguments[0] instanceof JavaScriptCallback)
|
if (arguments != null && arguments.length > 0 && arguments[0] instanceof JavaScriptCallback)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
((JavaScriptCallback) arguments[0]).run(event);
|
((JavaScriptCallback) arguments[0]).run(event);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
client.getLogger().error("Error in JavaScriptCallback", e);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user