forked from bartvdbraak/blender
added checks for zero length strings when checking for the last character
This commit is contained in:
parent
f35289574a
commit
6757b759ea
@ -1173,10 +1173,12 @@ int BLI_convertstringcode(char *path, const char *basepath)
|
||||
strcpy(path, tmp);
|
||||
}
|
||||
|
||||
if (path[strlen(path)-1]=='/') {
|
||||
BLI_cleanup_dir(NULL, path);
|
||||
} else {
|
||||
BLI_cleanup_file(NULL, path);
|
||||
if (path[0]!='\0') {
|
||||
if ( path[strlen(path)-1]=='/') {
|
||||
BLI_cleanup_dir(NULL, path);
|
||||
} else {
|
||||
BLI_cleanup_file(NULL, path);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -411,7 +411,7 @@ static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
last = strlen(path)-1;
|
||||
if ((path[last]=='/') || (path[last]=='\\')) {
|
||||
if ((last >= 0) && ((path[last]=='/') || (path[last]=='\\'))) {
|
||||
trailing_slash = 1;
|
||||
}
|
||||
BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);
|
||||
|
Loading…
Reference in New Issue
Block a user