aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js
index c59a50d1..fe2a0cb4 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -31,7 +31,11 @@ function SAFE_HEAP_ACCESS(dest, type, store, ignore) {
} else {
#if USE_TYPED_ARRAYS == 0
if (!HEAP[dest] && HEAP[dest] !== 0 && HEAP[dest] !== false) { // false can be the result of a mathop comparator
- throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
+ var error = true;
+ try {
+ if (HEAP[dest].toString() === 'NaN') error = false; // NaN is acceptable, as a double value
+ } catch(e){}
+ if (error) throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
}
#endif
if (type === null) return;