Validates arguments

This avoid a segfault if you pass `nil` to `hash`

Regards.

cc @csfrancis.