Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LR-EDIT-DETAIL-DENOISE: a remote denoise tile with values that aren't finite fails, and runs on this computer instead (follow-up to #813)

Claudee6af53d46c76
diff --git a/crates/denoise/src/remote.rs b/crates/denoise/src/remote.rs
index b40eacd6e..b8c51b98a 100644
--- a/crates/denoise/src/remote.rs
+++ b/crates/denoise/src/remote.rs
@@ -416,6 +416,11 @@ impl Remote {
let bytes = field(&v, "bytes").ok_or_else(|| self.err("an answer without its size"))?;
let out = read_payload(&mut r, bytes, 3 * 4 * t * t).map_err(|e| self.err(e))?;
self.pool.lock().unwrap_or_else(PoisonError::into_inner).push((r, s));
+ // the other computer's numbers go straight into the render: NaN or infinity (an f16 can carry
+ // both) is a failed tile, which `Shared` runs here instead
+ if !out.iter().all(|v| v.is_finite()) {
+ return Err(self.err("the answer holds values that aren't finite"));
+ }
Ok(out)
}
}