aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/iso19111/factory.cpp')
-rw-r--r--src/iso19111/factory.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index 49d2a737..5da9e6e0 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -4723,12 +4723,17 @@ AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates(
sourceCRSCode == targetCRSCode) {
return listTmp;
}
+ const auto sourceGeodCRS =
+ dynamic_cast<crs::GeodeticCRS *>(sourceCRS.get());
+ const auto targetGeodCRS =
+ dynamic_cast<crs::GeodeticCRS *>(targetCRS.get());
+ if (!sourceGeodCRS || !targetGeodCRS) {
+ return listTmp;
+ }
std::string minDate;
- const auto &sourceDatum =
- dynamic_cast<crs::GeodeticCRS *>(sourceCRS.get())->datum();
- const auto &targetDatum =
- dynamic_cast<crs::GeodeticCRS *>(targetCRS.get())->datum();
+ const auto &sourceDatum = sourceGeodCRS->datum();
+ const auto &targetDatum = targetGeodCRS->datum();
if (sourceDatum && sourceDatum->publicationDate().has_value() &&
targetDatum && targetDatum->publicationDate().has_value()) {
const auto sourceDate(sourceDatum->publicationDate()->toString());