Why to make an assert here? If tex is NULL, it will return false before.