Check for NULL before passing to vsnprintf