[4.2] Check For Foreign Key With A Null Value For belongsTo

This is to avoid the creation of unnecessary query that obviously returns an empty result.

---
Fixes #4371.
This is fine. `count()` returns an integer.