Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

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.

enter image description here

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: enter image description here

Here is some more code that might be important to you.

enter image description here

share|improve this question
    
Can you copy paste more code? – Antonio MG Feb 7 '14 at 15:17
    
Yea, sure. One moment. – FeaR CODE Feb 7 '14 at 15:17
    
@AntonioMG I added some more code, and even something i figured out. But i still do not know why the new issue has occurred. – FeaR CODE Feb 7 '14 at 15:28
1  
Your code looks OK to me and incidentally the !newEvents check is not necessary as newEvents.count will return 0 if newEvents == nil. This should at least simplify your code slightly. – trojanfoe Feb 7 '14 at 15:31
1  
The code you are providing doesn't help at all. Could you paste what happens before your failing "if", please? – Merlevede Feb 7 '14 at 15:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.