Why not just return early if curAlleleToCompare is null/invalid? (I haven't read through all the code, but it looks like you can do this).