Fixed: Correct null pointer dereference

pull/598/head
Richard 2015-07-02 05:50:21 -06:00
parent 8d82bf3338
commit e3ebef0094
3 changed files with 28 additions and 14 deletions

View File

@ -1320,8 +1320,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -1353,8 +1355,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),

View File

@ -168,8 +168,10 @@ void CLogWindow::Save()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),

View File

@ -474,8 +474,10 @@ void LoadBGTexture()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -597,8 +599,10 @@ void LoadSkybox()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -639,8 +643,10 @@ void SaveScreenshot()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
OPENFILENAME sFilename1 = { OPENFILENAME sFilename1 = {
sizeof(OPENFILENAME), sizeof(OPENFILENAME),
@ -938,8 +944,10 @@ void OpenAsset()
{ {
// need to remove the file name // need to remove the file name
char* sz = strrchr(szFileName,'\\'); char* sz = strrchr(szFileName,'\\');
if (!sz)sz = strrchr(szFileName,'/'); if (!sz)
if (!sz)*sz = 0; sz = strrchr(szFileName,'/');
if (sz)
*sz = 0;
} }
// get a list of all file extensions supported by ASSIMP // get a list of all file extensions supported by ASSIMP