ScriptVM: Catch exceptions thrown from a JavaScriptCallback
These shouldn't crash the client
This commit is contained in:
@@ -119,7 +119,14 @@ 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)
|
||||||
{
|
{
|
||||||
((JavaScriptCallback) arguments[0]).run(event);
|
try
|
||||||
|
{
|
||||||
|
((JavaScriptCallback) arguments[0]).run(event);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
client.getLogger().error("Error in JavaScriptCallback", e);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user