-
-
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
[Merged by Bors] - Don't panic when StandardMaterial normal_map hasn't loaded yet #5307
[Merged by Bors] - Don't panic when StandardMaterial normal_map hasn't loaded yet #5307
Conversation
This unwrap() in pbr_material.rs will be hit if the normal_map image has not finished loading, resulting in an error message that is hard to debug. This PR improves the error message including a potential indication of why the unwrap() could have panic'd.
Move it inside an |
makes sense to me, that's what I did to debug it in the first place. Updated the PR. |
@ChristopherBiscardi please update the PR title to better reflect the changes (they get used as our commit titles). Once that's done, ping me and I'll merge it. |
@alice-i-cecile Done. Does this title work? |
bors r+ |
# Objective [This unwrap()](https://github.com/bevyengine/bevy/blob/de484c1e4147d01bf34c88a10797b75128a0d98a/crates/bevy_pbr/src/pbr_material.rs#L195) in pbr_material.rs will be hit if a StandardMaterial normal_map image has not finished loading, resulting in an error message that is hard to debug. ## Solution ~~This PR improves the error message including a potential indication of why the unwrap() could have panic'd by using expect() instead of unwrap().~~ This PR removes the panic by only proceeding if the image is found. --- ## Changelog Don't panic when StandardMaterial normal_map images have not finished loading.
Pull request successfully merged into main. Build succeeded: |
…ngine#5307) # Objective [This unwrap()](https://github.com/bevyengine/bevy/blob/de484c1e4147d01bf34c88a10797b75128a0d98a/crates/bevy_pbr/src/pbr_material.rs#L195) in pbr_material.rs will be hit if a StandardMaterial normal_map image has not finished loading, resulting in an error message that is hard to debug. ## Solution ~~This PR improves the error message including a potential indication of why the unwrap() could have panic'd by using expect() instead of unwrap().~~ This PR removes the panic by only proceeding if the image is found. --- ## Changelog Don't panic when StandardMaterial normal_map images have not finished loading.
…ngine#5307) # Objective [This unwrap()](https://github.com/bevyengine/bevy/blob/de484c1e4147d01bf34c88a10797b75128a0d98a/crates/bevy_pbr/src/pbr_material.rs#L195) in pbr_material.rs will be hit if a StandardMaterial normal_map image has not finished loading, resulting in an error message that is hard to debug. ## Solution ~~This PR improves the error message including a potential indication of why the unwrap() could have panic'd by using expect() instead of unwrap().~~ This PR removes the panic by only proceeding if the image is found. --- ## Changelog Don't panic when StandardMaterial normal_map images have not finished loading.
…ngine#5307) # Objective [This unwrap()](https://github.com/bevyengine/bevy/blob/de484c1e4147d01bf34c88a10797b75128a0d98a/crates/bevy_pbr/src/pbr_material.rs#L195) in pbr_material.rs will be hit if a StandardMaterial normal_map image has not finished loading, resulting in an error message that is hard to debug. ## Solution ~~This PR improves the error message including a potential indication of why the unwrap() could have panic'd by using expect() instead of unwrap().~~ This PR removes the panic by only proceeding if the image is found. --- ## Changelog Don't panic when StandardMaterial normal_map images have not finished loading.
Objective
This unwrap() in pbr_material.rs will be hit if a StandardMaterial normal_map image has not finished loading, resulting in an error message that is hard to debug.
Solution
This PR improves the error message including a potential indication of why the unwrap() could have panic'd by using expect() instead of unwrap().This PR removes the panic by only proceeding if the image is found.
Changelog
Don't panic when StandardMaterial normal_map images have not finished loading.