Make RenderDoc::SetLogFile safer

logFile will be "" when the app is launched from renderdoccmd on Linux.
This commit is contained in:
Chia-I Wu
2016-03-08 10:28:40 +08:00
parent d6c48c60ef
commit 1f93ba2d3b
+4 -1
View File
@@ -773,9 +773,12 @@ void RenderDoc::SetCaptureOptions(const CaptureOptions &opts)
void RenderDoc::SetLogFile(const char *logFile)
{
if (logFile == NULL || logFile[0] == '\0')
return;
m_LogFile = logFile;
if(m_LogFile.substr(m_LogFile.length()-4) == ".rdc")
if(m_LogFile.length() > 4 && m_LogFile.substr(m_LogFile.length()-4) == ".rdc")
m_LogFile = m_LogFile.substr(0, m_LogFile.length()-4);
FileIO::CreateParentDirectory(m_LogFile);