From ecec875147b3ccf80be619bfa3c45b84ab4202f7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 2 Apr 2019 10:11:47 +0200 Subject: [PATCH] guard null pointer --- ThirdParty/Ert/lib/util/util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ThirdParty/Ert/lib/util/util.c b/ThirdParty/Ert/lib/util/util.c index b3eab9822..dfcab323f 100644 --- a/ThirdParty/Ert/lib/util/util.c +++ b/ThirdParty/Ert/lib/util/util.c @@ -2153,6 +2153,8 @@ int util_fmove( FILE * stream , long offset , long shift) { #ifdef HAVE_WINDOWS__ACCESS bool util_access(const char * entry, int mode) { + if (!entry) return false; + return (_access(entry, mode) == 0); } @@ -2160,6 +2162,8 @@ bool util_access(const char * entry, int mode) { #ifdef HAVE_POSIX_ACCESS bool util_access(const char * entry, mode_t mode) { + if (!entry) return false; + return (access(entry, mode) == 0); } #endif -- 2.21.0.windows.1