Make null string HTML-safe. Closes #3718.
(cherry picked from commit dc6509575c34a9ae54ef89af2a7c8aeb5f5bfddf)