summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-26 18:10:20 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-26 18:10:20 -0700
commitba35d6e3d4ce88a0493a8c93c8747294fd68a2d1 (patch)
tree24d7c068770c3fcfea4ce88081e244d6434d89c5
parent3a3f1d129896fad749cf802b41e72d8fc05f0cb8 (diff)
downloaddartboat-ba35d6e3d4ce88a0493a8c93c8747294fd68a2d1.tar.gz
dartboat-ba35d6e3d4ce88a0493a8c93c8747294fd68a2d1.tar.xz
web: prevent stdev from being set to NaN
-rw-r--r--web/dartboat_wasm.c7
1 files changed, 5 insertions, 2 deletions
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 <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -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()