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: crashes in empty data textures and infinite rotations #474

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/src/content/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ pub async fn load_image_texture(
.await
.map_err(anyhow::Error::msg)?;

if bytes_vec.is_empty() {
return Err(anyhow::Error::msg("Empty texture data"));
}

let _thread_safe_check = GodotSingleThreadSafety::acquire_owned(&ctx)
.await
.ok_or(anyhow::Error::msg("Failed trying to get thread-safe check"))?;
Expand Down
4 changes: 4 additions & 0 deletions lib/src/scene_runner/components/transform_and_parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ pub fn update_transform_and_parent(
}
}

if !transform.rotation.is_finite() {
transform.rotation = godot::prelude::Quaternion::default();
}

node_3d.set_transform(transform.to_godot_transform_3d_without_scaled());
if transform.scale.x.is_zero_approx() {
transform.scale.x = 0.00001;
Expand Down
Loading