Fixed: Make sure we handle undefined when testing for nil values (#2862)

This commit is contained in:
Martin Carlberg
2020-01-31 13:43:58 +01:00
committed by GitHub
parent 8daa53dd3e
commit 7dc77ed609
95 changed files with 280 additions and 280 deletions
+4 -4
View File
@@ -271,7 +271,7 @@
if (_disableSetContent)
return;
if (value === nil)
if (value == nil)
value = [];
if (![value isKindOfClass:[CPArray class]])
@@ -754,7 +754,7 @@
_filterPredicate = nil;
[self _rearrangeObjects];
}
else if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
else if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
{
// Insert directly into the array.
var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors];
@@ -767,7 +767,7 @@
[_selectionIndexes shiftIndexesStartingAtIndex:pos by:1];
}
/*
else if (_filterPredicate !== nil)
else if (_filterPredicate != nil)
...
// Implies _filterPredicate && ![_filterPredicate evaluateWithObject:object], so the new object does
// not appear in arrangedObjects and we do not have to update at all.
@@ -867,7 +867,7 @@
_disableSetContent = NO;
if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
{
// selectionIndexes change notification will be fired as a result of the
// content change. Don't fire manually.