filesys.cpp: Add nullptr guards to isDir(), isFile(), isLink().
This commit is contained in:
parent
bd43bd7e30
commit
f4852f7b90
@ -63,6 +63,9 @@ bool cw::filesys::isDir( const char* dirStr )
|
||||
|
||||
errno = 0;
|
||||
|
||||
if( dirStr == nullptr )
|
||||
return false;
|
||||
|
||||
if( stat(dirStr,&s) != 0 )
|
||||
{
|
||||
// if the dir does not exist
|
||||
@ -81,6 +84,9 @@ bool cw::filesys::isFile( const char* fnStr )
|
||||
struct stat s;
|
||||
errno = 0;
|
||||
|
||||
if( fnStr == nullptr )
|
||||
return false;
|
||||
|
||||
if( stat(fnStr,&s) != 0 )
|
||||
{
|
||||
|
||||
@ -101,6 +107,9 @@ bool cw::filesys::isLink( const char* fnStr )
|
||||
struct stat s;
|
||||
errno = 0;
|
||||
|
||||
if( fnStr == nullptr )
|
||||
return false;
|
||||
|
||||
if( lstat(fnStr,&s) != 0 )
|
||||
{
|
||||
// if the file does not exist
|
||||
@ -314,6 +323,9 @@ char* cw::filesys::expandPath( const char* dir )
|
||||
|
||||
memset(&res,0,sizeof(res));
|
||||
|
||||
if( dir == nullptr )
|
||||
return nullptr;
|
||||
|
||||
if((sysRC = wordexp(dir,&res,flags)) != 0)
|
||||
{
|
||||
switch(sysRC)
|
||||
|
Loading…
Reference in New Issue
Block a user