Skip to content

Commit

Permalink
fixed: do not dereference NULL when localtime fails
Browse files Browse the repository at this point in the history
  • Loading branch information
CrystalP authored and CrystalP committed Apr 29, 2012
1 parent 5e265ec commit 31a4f01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xbmc/video/VideoDatabase.cpp
Expand Up @@ -695,7 +695,9 @@ void CVideoDatabase::UpdateFileDateAdded(int idFile, const CStdString& strFileNa
if (CFile::Stat(file, &buffer) == 0)
{
time_t maxTime = max((time_t)buffer.st_ctime, (time_t)buffer.st_mtime);
dateAdded = *localtime(&maxTime);
struct tm *time = localtime(&maxTime);
if (time)
dateAdded = *time;
}

if (!dateAdded.IsValid())
Expand Down

0 comments on commit 31a4f01

Please sign in to comment.