protects the server from crashing when text is undefined, due to substr ...

...call

server will crash if the post has no text, as post.text will be undefined and substr is called on it.