mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Fix for the "Empty or white space strings equal 0" bug
See: Empty or white space strings equal 0 #435
This commit is contained in:
parent
aecc3bf893
commit
cf215bf0bc
1 changed files with 6 additions and 0 deletions
|
@ -100,6 +100,12 @@ Cast.toRgbColorObject = function (value) {
|
|||
Cast.compare = function (v1, v2) {
|
||||
var n1 = Number(v1);
|
||||
var n2 = Number(v2);
|
||||
if (n1 === 0 && (v1 == null || typeof v1 === 'string' && v1.trim().length === 0)) {
|
||||
n1 = NaN;
|
||||
}
|
||||
if (n2 === 0 && (v2 == null || typeof v2 === 'string' && v2.trim().length === 0)) {
|
||||
n2 = NaN;
|
||||
}
|
||||
if (isNaN(n1) || isNaN(n2)) {
|
||||
// At least one argument can't be converted to a number.
|
||||
// Scratch compares strings as case insensitive.
|
||||
|
|
Loading…
Reference in a new issue