Fix crash caused by empty html from message builder

Fix crash when flatten was eventually called on empty html string from MessageBuilder.