From 27d6a335dba16a083f5ecf76e8ce8d6034bb130f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 22 Feb 2022 17:21:51 +0100 Subject: geog3DToVertTryThroughGeog2D(): avoid potential nullptr deref (CID 383355) --- src/iso19111/operation/coordinateoperationfactory.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') 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())); -- cgit v1.2.3