Fix buffer error when text is None