Skip to content

Commit

Permalink
Fix infinite loop not being properly caught, Closes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 28, 2024
1 parent f020909 commit 90544e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.cyclops.integratedscripting.api.network;

import org.cyclops.integrateddynamics.api.evaluate.EvaluationException;

import javax.annotation.Nullable;

/**
Expand All @@ -14,7 +16,7 @@ public interface IScript {
* @return The member, or null if it does not exist.
*/
@Nullable
public IScriptMember getMember(String memberName);
public IScriptMember getMember(String memberName) throws EvaluationException;

/**
* Register a listener that will be invoked when this script gets invalidated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ public GraalScript(Context graalContext, Value graalValue,

@Nullable
@Override
public IScriptMember getMember(String memberName) {
Value member = this.graalValue.getMember(memberName);
public IScriptMember getMember(String memberName) throws EvaluationException {
Value member;
try {
member = this.graalValue.getMember(memberName);
} catch (PolyglotException e) {
throw ScriptHelpers.getEvaluationExceptionFactory(disk, path, memberName).createError(e.getMessage());
}
return member == null ? null : new GraalScript(this.graalContext, member, this.addInvalidationListener, this.removeInvalidationListener, disk, path, memberName);
}

Expand Down

0 comments on commit 90544e7

Please sign in to comment.