Prevent on user input calculation for null case is failing

Prevent on user input calculation for null case is failing

I have a dropdown list with years in it. When a user selects a year, the code converts it into a number, and then does a calculation. However if the user selects "-Select-" from the dropdown, the form throws an error.

I have tried to prevent this using the following code

if(input.HSGY  ==  null)
{
//nothing
}
else
{
n=input.HSGY.toLong();
input.Grade=thisapp.Grad_Year(n);
}

It's ignoring the null case (which is "-Select-")

Cheers,
John Whitney