aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-02-22 17:21:51 +0100
committerEven Rouault <even.rouault@spatialys.com>2022-02-22 17:21:51 +0100
commit27d6a335dba16a083f5ecf76e8ce8d6034bb130f (patch)
tree32ea9e79e558f0576170cc6fa85e693739b1e7ec
parent5183706cd753929039c29bfadb874623f4df83a1 (diff)
downloadPROJ-27d6a335dba16a083f5ecf76e8ce8d6034bb130f.tar.gz
PROJ-27d6a335dba16a083f5ecf76e8ce8d6034bb130f.zip
geog3DToVertTryThroughGeog2D(): avoid potential nullptr deref (CID 383355)
-rw-r--r--src/iso19111/operation/coordinateoperationfactory.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp
index 6b7d4d20..20042f22 100644
--- a/src/iso19111/operation/coordinateoperationfactory.cpp
+++ b/src/iso19111/operation/coordinateoperationfactory.cpp
@@ -3829,13 +3829,10 @@ void CoordinateOperationFactory::Private::
[&res, &context](const crs::GeographicCRS *geogSrcIn,
const crs::VerticalCRS *vertDstIn,
const crs::CRSNNPtr &targetCRSIn) {
- if (res.empty() && geogSrcIn && vertDstIn &&
+ const auto &authFactory = context.context->getAuthorityFactory();
+ if (res.empty() && geogSrcIn && vertDstIn && authFactory &&
geogSrcIn->coordinateSystem()->axisList().size() == 3) {
- const auto &authFactory =
- context.context->getAuthorityFactory();
- const auto dbContext =
- authFactory ? authFactory->databaseContext().as_nullable()
- : nullptr;
+ const auto &dbContext = authFactory->databaseContext();
const auto candidatesSrcGeod(findCandidateGeodCRSForDatum(
authFactory, geogSrcIn,
geogSrcIn->datumNonNull(dbContext).get()));