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

Fix exception when no world available to explode effect. #6588

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

Moderocky
Copy link
Member

Description

Adds a check for the location having a world in the create explosion effect.
If there is no world present then the effect will not occur (since we do not know where it should take place!)


Target Minecraft Versions: any
Requirements: none
Related Issues: closes #6481

@Moderocky Moderocky added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.8 Targeting a 2.8.X version release labels Apr 19, 2024
@@ -78,11 +78,13 @@ public void execute(final Event e) {
final Number power = force != null ? force.getSingle(e) : 0;
if (power == null)
return;
for (final Location l : locations.getArray(e)) {
for (Location location : locations.getArray(e)) {
if (location.getWorld() == null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's technically possible we could extract a location by checking whether only one world exists or looking for the default entity in the current event or whatever, but that feels like a really patchwork solution and in all other similar syntax we just skip it/return null when the world's null.

@Moderocky Moderocky merged commit 0796515 into SkriptLang:dev/patch Apr 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.8 Targeting a 2.8.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants