fixed bug : write null text and set escape=true will throw NPE