Section 49. If a person nominated to be voted for at a state primary dies before the day of the primary, or withdraws his name from nomination, or is found ineligible, and there is no other candidate for the party nomination for the office, the vacancy may be filled by the state committee, if the candidate is one to be voted for by all the voters of the commonwealth; and, in the case of candidates for nomination or election in a district, by the members of the ward and town committees in the wards and towns comprising the district.