I think you're missing some parentheses here:

```
(!f || (f->isNested() || f->isThis())) &&
```

Or you may end up dereferencing NULL.