aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2019-02-27 15:06:55 +0100
committerGitHub <noreply@github.com>2019-02-27 15:06:55 +0100
commitd3276a07b8a48e600332419d12886c34527d3162 (patch)
tree4dfbf0b488eaa385802676a9b249714b5ab8ef2a /src
parent0a78cc67fc06d2fe1769c5582ce5b8b92b1ef4a3 (diff)
parent38f7a68edbb0a5d4a64d98b8297f4281a5d400d0 (diff)
downloadPROJ-d3276a07b8a48e600332419d12886c34527d3162.tar.gz
PROJ-d3276a07b8a48e600332419d12886c34527d3162.zip
Merge pull request #1298 from QuLogic/fix-default-ctx
Fix a couple issues with default context fallback
Diffstat (limited to 'src')
-rw-r--r--src/internal.cpp4
-rw-r--r--src/open_lib.cpp6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/internal.cpp b/src/internal.cpp
index 44246842..b4b7a683 100644
--- a/src/internal.cpp
+++ b/src/internal.cpp
@@ -491,9 +491,7 @@ void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf) {
passed as first arg at each call to the logger
******************************************************************************/
if (nullptr==ctx)
- pj_get_default_ctx ();
- if (nullptr==ctx)
- return;
+ ctx = pj_get_default_ctx ();
ctx->logger_app_data = app_data;
if (nullptr!=logf)
ctx->logger = logf;
diff --git a/src/open_lib.cpp b/src/open_lib.cpp
index 510704e9..a00d3d0e 100644
--- a/src/open_lib.cpp
+++ b/src/open_lib.cpp
@@ -194,10 +194,10 @@ pj_open_lib_ex(projCtx ctx, const char *name, const char *mode,
sysname = name;
/* or try to use application provided file finder */
- else if( ctx && ctx->file_finder != nullptr && (sysname = ctx->file_finder( ctx, name, ctx->file_finder_user_data )) != nullptr )
+ else if( ctx->file_finder != nullptr && (sysname = ctx->file_finder( ctx, name, ctx->file_finder_user_data )) != nullptr )
;
- else if( ctx && ctx->file_finder_legacy != nullptr && (sysname = ctx->file_finder_legacy( name )) != nullptr )
+ else if( ctx->file_finder_legacy != nullptr && (sysname = ctx->file_finder_legacy( name )) != nullptr )
;
/* or is environment PROJ_LIB defined */
@@ -234,7 +234,7 @@ pj_open_lib_ex(projCtx ctx, const char *name, const char *mode,
}
/* If none of those work and we have a search path, try it */
- if (!fid && ctx && !ctx->search_paths.empty() )
+ if( !fid && !ctx->search_paths.empty() )
{
for( const auto& path: ctx->search_paths ) {
try {