Note that if the antimeridian points are properly normalised (so that longitudes are always the same, -180°), both startFragment and endFragment should exist, so this branch shouldn’t ever be taken.

However, I noticed that you have commented out longitude wrapping, which means that looking one of the lookups could fail because it has the wrong sign for the longitude (+180° vs. -180°).

Re-enabling longitude wrapping means that the branch isn’t taken at all for the ocean example.  Without longitude wrapping, the branch is taken once only, and I verified it’s the sign issue.