-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
use get_entity_mut
in insert commands to avoid a panic
#2236
Conversation
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a sensible change and is well motivated. The only possible thought is that it might hurt performance in noticeable ways.
Are you alright trying to run some benchmarks? We can walk you through it.
I can't possibly see it having a performance impact, as |
Great! I'm going to toss on the ready-for-cart label then. |
A few observations:
I actually have a PR incoming (most likely today) that's adds custom error handling for fallible commands. And the good news is that the new default is to not panic! and error! 😊😊 |
I agree that the error should probably be propagated. In the case of applying commands at the end of a stage, silently ignoring an error is probably the right behaviour. |
At the moment, the
insert
andinsert_bundle
commands issued through aCommands
struct in a system can cause a panic when applied if the entity the command is used for no longer exists. This fixes that problem via the use ofget_entity_mut
, and brings them inline with the other commands.