Not in most cases, there are "outs" for the cases of a candidate who dies, or becomes unable to take office. California's law for example. Look it up.
But nothing prevents them from still voting for him; dead, ineligible, or whatever.