aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-17 10:42:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-17 10:42:36 -0700
commited40b36281285c39011240c16459d12c7acec9f7 (patch)
tree8e62d24cb96dcd1dff5349e5efa2dd8c34343a38
parent396cb4f707dfab0a38edc40b430b441da353ffbb (diff)
safe heap fix to catch undefined properly
-rw-r--r--src/preamble.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e73089cb..986592ee 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -76,7 +76,7 @@ function SAFE_HEAP_STORE(dest, value, type, ignore) {
Module.print('SAFE_HEAP store: ' + [dest, type, value, ignore]);
#endif
- if (!ignore && !value && value !== 0 && value !== false && !isNaN(value)) { // false can be the result of a mathop comparator; NaN can be the result of a math function
+ if (!ignore && !value && (value === null || value === undefined)) {
throw('Warning: Writing an invalid value of ' + JSON.stringify(value) + ' at ' + dest + ' :: ' + new Error().stack + '\n');
}
SAFE_HEAP_ACCESS(dest, type, true, ignore);