diff --git a/src/osgDB/FileUtils_Unix.cpp b/src/osgDB/FileUtils_Unix.cpp index 1bbb4da61..c4e7710d9 100644 --- a/src/osgDB/FileUtils_Unix.cpp +++ b/src/osgDB/FileUtils_Unix.cpp @@ -93,6 +93,7 @@ char *osgDB::findFileInPath( const char *_file, const char * filePath ) char *path = 0L; notify(DEBUG_INFO) << "FindFileInPath() : trying " << _file << " ...\n"; + if( access( _file, F_OK ) == 0 ) { return strdup(_file); @@ -100,7 +101,9 @@ char *osgDB::findFileInPath( const char *_file, const char * filePath ) tptr = strdup( filePath ); tmppath = strtok( tptr, PathDelimitor ); - + + if (!tmppath) return NULL; + do { sprintf( pathbuff, "%s/%s", tmppath, _file ); diff --git a/src/osgDB/FileUtils_Windows.cpp b/src/osgDB/FileUtils_Windows.cpp index 628945440..9c28037fa 100644 --- a/src/osgDB/FileUtils_Windows.cpp +++ b/src/osgDB/FileUtils_Windows.cpp @@ -93,6 +93,8 @@ char *osgDB::findFileInPath( const char *_file, const char * filePath ) tptr = strdup( filePath ); tmppath = strtok( tptr, PathDelimitor ); + if (!tmppath) return NULL; + do { sprintf( pathbuff, "%s/%s", tmppath, _file );