aboutsummaryrefslogtreecommitdiff
path: root/src/open_lib.cpp
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2019-02-27 05:58:12 -0500
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2019-02-27 05:58:12 -0500
commite1e52f28fa0f7fd14fe7dfd23aea2dbf65cda11e (patch)
treef4c1fe555fb1bdafea19fd31c656c25145328a3d /src/open_lib.cpp
parentf78661f84d8c0d7912b31a1b19c2a0cd4f85d061 (diff)
downloadPROJ-e1e52f28fa0f7fd14fe7dfd23aea2dbf65cda11e.tar.gz
PROJ-e1e52f28fa0f7fd14fe7dfd23aea2dbf65cda11e.zip
Fix null dereference warning.
Counter-intuitively, this means removing checks for nullptr. The compiler sees these checks and thinks the one remaining dereference is missing a check. However, since pj_get_default_ctx cannot return nullptr, these tests are redundant.
Diffstat (limited to 'src/open_lib.cpp')
-rw-r--r--src/open_lib.cpp6
1 files changed, 3 insertions, 3 deletions
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 {