diff --git a/django/contrib/gis/gdal/field.py b/django/contrib/gis/gdal/field.py index 1a2218821a45..450e7d3720b7 100644 --- a/django/contrib/gis/gdal/field.py +++ b/django/contrib/gis/gdal/field.py @@ -217,7 +217,7 @@ def value(self): seconds = int(ss.value) milliseconds = int(round((ss.value - seconds) * 1000)) return time(hh.value, mn.value, seconds, milliseconds * 1000) - except (ValueError, GDALException): + except (TypeError, ValueError, GDALException): return None diff --git a/tests/gis_tests/data/has_nulls/has_nulls.geojson b/tests/gis_tests/data/has_nulls/has_nulls.geojson index 8ae52a187782..3bd34308fe13 100644 --- a/tests/gis_tests/data/has_nulls/has_nulls.geojson +++ b/tests/gis_tests/data/has_nulls/has_nulls.geojson @@ -59,7 +59,6 @@ "type": "Feature", "properties": { "uuid": "fa2ba67c-a135-4338-b924-a9622b5d869f", - "time": "00:00:00", "integer": null, "num": null }, diff --git a/tests/gis_tests/gdal_tests/test_ds.py b/tests/gis_tests/gdal_tests/test_ds.py index ea16c06f4a25..a5904cbbc772 100644 --- a/tests/gis_tests/gdal_tests/test_ds.py +++ b/tests/gis_tests/gdal_tests/test_ds.py @@ -110,7 +110,7 @@ None, datetime.strptime("2018-11-29T03:02:52", datetime_format), ], - "time": [time(11, 32, 14, 123000), time(0), time(3, 2, 52)], + "time": [time(11, 32, 14, 123000), None, time(3, 2, 52)], }, fids=range(3), ),