From f424c864654946816f05130206eaaa18675aaf5f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 25 May 2002 09:30:38 +0000 Subject: [PATCH] Fixed crash associated with searching in an empty filepath. --- src/osgDB/FileUtils_Unix.cpp | 5 ++++- src/osgDB/FileUtils_Windows.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 );