Add missing argument checks
Add missing argument checks

The APIs should validate their arguments and return an error value
(if possible), like NULL in this case. Situations like this should
NOT trigger asserts as it's not a logical error, it's simply a bad
input.

Zeex/sampgdk,Zeex/sampgdk,WopsS/sampgdk,Zeex/sampgdk,WopsS/sampgdk,WopsS/sampgdk