Please, share the entire code, not just a segment.
The problem is probably within the checkLeap function.
Also, if there is any error message, please share that as well.
One more note: why do you set leayYr to 1 or 0. Doesn't it hold the actual year (e.g. 2020)?