aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/io.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/iso19111/io.cpp')
-rw-r--r--src/iso19111/io.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 5ccd9642..cbf5e150 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -5881,11 +5881,14 @@ BaseObjectNNPtr createFromUserInput(const std::string &text,
* @throw ParsingException
*/
BaseObjectNNPtr createFromUserInput(const std::string &text, PJ_CONTEXT *ctx) {
- return createFromUserInput(
- text, ctx != nullptr && ctx->cpp_context
- ? ctx->cpp_context->databaseContext.as_nullable()
- : nullptr,
- false, ctx);
+ DatabaseContextPtr dbContext;
+ try {
+ if (ctx != nullptr && ctx->cpp_context) {
+ dbContext = ctx->cpp_context->getDatabaseContext().as_nullable();
+ }
+ } catch (const std::exception &) {
+ }
+ return createFromUserInput(text, dbContext, false, ctx);
}
// ---------------------------------------------------------------------------