Fix crash when getting preview with long html tags

Closes: bgo #726468