From b8bfc13cf9a184125700ebaee5f96498d6973b57 Mon Sep 17 00:00:00 2001 From: Loki Date: Sun, 8 Aug 2021 13:59:43 +0200 Subject: [PATCH] Prevent segfault on empty string_view --- sunshine/utility.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sunshine/utility.h b/sunshine/utility.h index be63f475..af2da53e 100644 --- a/sunshine/utility.h +++ b/sunshine/utility.h @@ -389,6 +389,10 @@ auto enm(T &val) -> std::underlying_type_t & { } inline std::int64_t from_chars(const char *begin, const char *end) { + if(begin == end) { + return 0; + } + std::int64_t res {}; std::int64_t mul = 1; while(begin != --end) {