Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkriptParser incorrectly checks whether an expression in a pattern is nullable #6202

Open
1 task done
APickledWalrus opened this issue Nov 23, 2023 · 0 comments
Open
1 task done
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@APickledWalrus
Copy link
Member

Skript/Server Version

n/a

Bug Description

A user on discord reported this error:
ch.njol.skript.SkriptAPIException: The class 'object' does not provide a default expression. Either allow null (with %-object%) or make it mandatory [pattern: (execute|run) function <.+> [and store it in %~-objects%]]

This is because SkriptParser only checks the first character of the input to determine if the expression is nullable. It is not guaranteed to be the first character. Other areas of Skript (e.g. TypePatternElement) account for this.

if (!name.startsWith("-")) {

The best solution is likely to call getExprInfo and then just check whether the ExprInfo has it marked as nullable. This method does cache the input though so I'm not sure if that may be unwanted if the expression is nullable.

Expected Behavior

Skript should identify the expression as nullable and not print an error that it is does not allow null.

Steps to Reproduce

In a pattern, use a flag mask and then a nullable indicator, e.g. %~-objects%

Errors or Screenshots

full stacktrace: https://paste.gg/p/anonymous/fba5298c26b140198e1e7db93d410497

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Nov 23, 2023
@APickledWalrus APickledWalrus added the completed The issue has been fully resolved and the change will be in the next Skript update. label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

1 participant