1
0
mirror of synced 2025-01-18 17:14:13 +01:00

Actually fix time_t decoding crash on Linux

This commit is contained in:
misson20000 2020-11-22 18:00:17 -08:00
parent c977baecc4
commit 7cf69128ea

View File

@ -92,7 +92,7 @@ namespace hex {
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time, this->m_endianess);
std::tm * ptm = localtime(&endianAdjustedTime);
char buffer[64];
if (std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0)
if (ptm != nullptr && std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0)
this->m_cachedData.emplace_back("time_t", buffer);
else
this->m_cachedData.emplace_back("time_t", "Invalid");