From ba35d6e3d4ce88a0493a8c93c8747294fd68a2d1 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Tue, 26 Apr 2022 18:10:20 -0700 Subject: web: prevent stdev from being set to NaN --- web/dartboat_wasm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c index f8a076d..bc384dc 100644 --- a/web/dartboat_wasm.c +++ b/web/dartboat_wasm.c @@ -1,6 +1,7 @@ #include "checkouts.h" #include "comp.h" +#include #include #include #include @@ -448,8 +449,10 @@ EMSCRIPTEN_KEEPALIVE void set_delay(int delay) EMSCRIPTEN_KEEPALIVE void set_stdev(float hstdev, float vstdev) { - horizontal_stdev = hstdev; - vertical_stdev = vstdev; + if (!isnan(hstdev)) + horizontal_stdev = hstdev; + if (!isnan(vstdev)) + vertical_stdev = vstdev; } void init_boat() -- cgit v1.2.3-70-g09d2