[FIX] Geometry functions are vulnerable to segfaults from bad user parameters