mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Crash when selecting invalid time_t
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user