Check $localver is defined in earlier if statement to prevent undef error

//cc @russellholt @malbin