fix pk3dir/dpk/dpkdir code

This commit is contained in:
Timothee Besset 2018-01-22 09:03:45 -06:00
parent 921dc5083c
commit f00e8fd6a6
1 changed files with 3 additions and 3 deletions

View File

@ -200,18 +200,18 @@ void vfsInitDirectory( const char *path ){
char *ext = strrchr( dirlist, '.' ); char *ext = strrchr( dirlist, '.' );
if ( ext && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) { if ( ext != NULL && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) {
if ( g_numDirs == VFS_MAXDIRS ) { if ( g_numDirs == VFS_MAXDIRS ) {
continue; continue;
} }
snprintf( g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name ); snprintf( g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name );
g_strDirs[g_numDirs][PATH_MAX] = '\0'; g_strDirs[g_numDirs][PATH_MAX-1] = '\0';
vfsFixDOSName( g_strDirs[g_numDirs] ); vfsFixDOSName( g_strDirs[g_numDirs] );
vfsAddSlash( g_strDirs[g_numDirs] ); vfsAddSlash( g_strDirs[g_numDirs] );
++g_numDirs; ++g_numDirs;
} }
if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) { if ( ext == NULL || ( Q_stricmp( ext, ".pk3" ) != 0 && Q_stricmp( ext, ".dpk" ) != 0 ) ) {
continue; continue;
} }
} }