`null` relation raises exception

I've got a relation that sometimes is set to `null`. In JS, `typeof null === 'object'`, and then this line of code was calling `Object.keys` on `null` (non object).

If this bugfix is correct I'll add regression tests, else, happy to improve the patch.

Thanks for your work!