I would get rid of this check - it just hides an actual error which is passing invalid data to this function (`None`, `''`, ...).