aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/types/Date.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-09-25 20:04:07 +0200
committer Hop311 <hop3114@gmail.com>2023-09-25 20:04:07 +0200
commitb84f5a03b40f1925c456cd247c2c2f04af8ef778 (patch)
treecec684e859b9631bd581699563800bb9888990db /src/openvic-simulation/types/Date.cpp
parentbbfa8faf5337ebdff60ef2106074417aa628eca1 (diff)
Calculate terrain types from pixels
Diffstat (limited to 'src/openvic-simulation/types/Date.cpp')
-rw-r--r--src/openvic-simulation/types/Date.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvic-simulation/types/Date.cpp b/src/openvic-simulation/types/Date.cpp
index 3449591..203d647 100644
--- a/src/openvic-simulation/types/Date.cpp
+++ b/src/openvic-simulation/types/Date.cpp
@@ -190,7 +190,7 @@ Date Date::from_string(char const* const str, char const* const end, bool* succe
bool sub_successful = false;
uint64_t val = StringUtils::string_to_uint64(str, year_end, &sub_successful, 10);
- if (!sub_successful || val >= 1 << (8 * sizeof(year_t))) {
+ if (!sub_successful || val > std::numeric_limits<year_t>::max()) {
Logger::error("Failed to read year: ", std::string_view { str, static_cast<size_t>(end - str) });
if (successful != nullptr) *successful = false;
return { year, month, day };