[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.