ran into something similar when doing the new buffers. added that and `assert(buf != NULL)` just to make double sure. saved me from a few bugs while implementing them internally (was doing the same thing where the values should have been validated _before_ reaching the function, but eh. never know. =)