Check that scripting engine supports Invocable before casting
This commit is contained in:
parent
8c00dbf159
commit
45c41537ed
@ -103,7 +103,9 @@ public class ScriptingExtension extends AbstractSimulationExtension {
|
||||
throw new SimulationException("Invalid script: " + e.getMessage());
|
||||
}
|
||||
|
||||
// TODO: Check for implementation first
|
||||
if (!(engine instanceof Invocable)) {
|
||||
throw new SimulationException("The scripting language '" + getLanguage() + "' does not implement the Invocable interface");
|
||||
}
|
||||
return new ScriptingSimulationListener((Invocable) engine);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user