@csherratt
Avoid calling truncate with a invalid size if result_len is 0
b31b96b