diff --git a/src/core/Ingredient.mjs b/src/core/Ingredient.mjs index 319dfb15..ab276fc0 100755 --- a/src/core/Ingredient.mjs +++ b/src/core/Ingredient.mjs @@ -99,8 +99,6 @@ class Ingredient { * @param {string} type - The name of the data type. */ static prepare(data, type) { - let number; - switch (type) { case "binaryString": case "binaryShortString": @@ -116,7 +114,9 @@ class Ingredient { } case "number": if (data === null) return data; - number = parseFloat(data); + if (isNaN(data)) throw "Ingredient can not be empty."; + + let number = parseFloat(data); if (isNaN(number)) { const sample = Utils.truncate(data.toString(), 10); throw "Invalid ingredient value. Not a number: " + sample;