isEmpty is counting nil references
RodolfoAntonici opened this issue · comments
As we can se in the issue #20, the delegates.count
property will count nil references, which would cause the following implementation to fail:
public var isEmpty: Bool {
return delegates.count == 0
}
To solve that:
public var isEmpty: Bool {
return delegates.allObjects.count == 0
}
This will only count existing objects, nil references won't be indexed in the allObjects
.
Good finding!
from apple docs:
var allObjects: [ObjectType]
The hash table’s members.
var count: Int
The number of elements in the hash table.
tag: 2.1.3