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 panics and docs when using World schedules #8364

Merged
merged 3 commits into from
Apr 12, 2023

Conversation

JoJoJet
Copy link
Member

@JoJoJet JoJoJet commented Apr 12, 2023

Objective

The method World::try_run_schedule currently panics if the Schedules resource does not exist, but it should just return an Err. Similarly, World::add_schedule panics unnecessarily if the resource does not exist.

Also, the documentation for World::add_schedule is completely wrong.

Solution

When the Schedules resource does not exist, we now treat it the same as if it did exist but was empty. When calling add_schedule, we initialize it if it does not exist.

@JoJoJet JoJoJet added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Apr 12, 2023
@JoJoJet JoJoJet added this to the 0.10.2 milestone Apr 12, 2023
@JoJoJet JoJoJet added the P-Crash A sudden unexpected crash label Apr 12, 2023
@JoJoJet JoJoJet changed the title Fix a panic in try_run_schedule Fix panics and docs when using World schedules Apr 12, 2023
@JoJoJet
Copy link
Member Author

JoJoJet commented Apr 12, 2023

I fixed a couple more related issues that I noticed.

@JoJoJet JoJoJet added the C-Docs An addition or correction to our documentation label Apr 12, 2023
@cart cart added this pull request to the merge queue Apr 12, 2023
Merged via the queue into bevyengine:main with commit f3c7cce Apr 12, 2023
@JoJoJet JoJoJet deleted the try-run-schedule branch April 12, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior C-Docs An addition or correction to our documentation P-Crash A sudden unexpected crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants