diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index 470f738d7..515805c53 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -625,7 +625,12 @@ namespace hex::plugin::builtin { std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); + auto time = std::localtime(&endianAdjustedTime); + if (time == nullptr) { + value = "Invalid"; + } else { + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); + } } catch (fmt::format_error &) { value = "Invalid"; } @@ -640,7 +645,12 @@ namespace hex::plugin::builtin { std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); + auto time = std::localtime(&endianAdjustedTime); + if (time == nullptr) { + value = "Invalid"; + } else { + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); + } } catch (fmt::format_error &) { value = "Invalid"; } @@ -657,7 +667,12 @@ namespace hex::plugin::builtin { std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); + auto time = std::localtime(&endianAdjustedTime); + if (time == nullptr) { + value = "Invalid"; + } else { + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *time); + } } catch (fmt::format_error &e) { value = "Invalid"; }