diff options
Diffstat (limited to 'src/iso19111/c_api.cpp')
| -rw-r--r-- | src/iso19111/c_api.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 340d9fb9..90c8a8cd 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -348,6 +348,10 @@ const char *proj_context_get_database_metadata(PJ_CONTEXT *ctx, // temporary variable must be used as getDBcontext() might create // ctx->cpp_context auto osVal(getDBcontext(ctx)->getMetadata(key)); + if (osVal == nullptr) { + ctx->cpp_context->autoCloseDbIfNeeded(); + return nullptr; + } ctx->cpp_context->lastDbMetadataItem_ = osVal; ctx->cpp_context->autoCloseDbIfNeeded(); return ctx->cpp_context->lastDbMetadataItem_.c_str(); |
