Why does this block of code not fire? The Array contains 0 objects, so i thought that the array.count == 0
should have worked in this case.
Instead, the code goes to the else
statement. What am i doing wrong? Or what might be causing this?
Code:
if (indexPath.section == 0) {
if (!newEvents || newEvents.count == 0)
{
// Do stuff
}
else
{
// do stuff
}
}
else
{
if (!oldEvents || oldEvents.count == 0)
{
// Do stuff
}
else
{
// Do stuff
}
}
Edit
After looking further into it, i have found that this is not firing, making it seem the other is not:
Here is some more code that might be important to you.
!newEvents
check is not necessary asnewEvents.count
will return0
ifnewEvents == nil
. This should at least simplify your code slightly. – trojanfoe Feb 7 '14 at 15:31