Skip to content
Permalink
Browse files

Error on invalid rotation values in XRRigidTransform constructor

  • Loading branch information...
Manishearth committed Jul 11, 2019
1 parent 0b88c56 commit 036b495cb253f668e88c11813f750b0e537a32bd
Showing with 6 additions and 0 deletions.
  1. +6 −0 components/script/dom/xrrigidtransform.rs
@@ -77,6 +77,12 @@ impl XRRigidTransform {
orientation.z as f32,
orientation.w as f32,
);

if !rotate.i.is_finite() {
// if quaternion has zero norm, we'll get an infinite or NaN
// value for each element. This is preferable to checking for zero.
return Err(Error::InvalidState);
}
let transform = TypedRigidTransform3D::new(rotate, translate);
Ok(XRRigidTransform::new(&window.global(), transform))
}

0 comments on commit 036b495

Please sign in to comment.
You can’t perform that action at this time.