Fix exception for None geometries in PostgreSQL.

If a row has no value for a geometry, a query will raise an exception.
This fixes it and returns the original value (None) instead.