MT#8729 Fix valid_media_type regex

dies on undef value