Fix bug: avoid crashing when geometry is None