Fixed template engine crash when no media is available