diff options
| author | Olli Räisä <olli.raisa@trimble.com> | 2020-06-10 12:52:14 +0300 |
|---|---|---|
| committer | Olli Räisä <olli.raisa@trimble.com> | 2020-06-10 12:52:14 +0300 |
| commit | adeca911c16bc783963ee98d075a75b70d46b110 (patch) | |
| tree | 725dc7c60e498fe4f4923a0cf25765b524653950 /src | |
| parent | 144a611f844450f5ce4528772136f985c92406fe (diff) | |
| download | PROJ-adeca911c16bc783963ee98d075a75b70d46b110.tar.gz PROJ-adeca911c16bc783963ee98d075a75b70d46b110.zip | |
Fix access violation in proj_context_get_database_metadata
Diffstat (limited to 'src')
| -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(); |
