From b0f192d8789edc3c7c7029622efa4a2b80a4c75e Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 29 Jan 2022 15:48:24 +0100 Subject: [PATCH] Fix warning: maybe-uninitialized ../../components/misc/color.cpp: In static member function 'static Misc::Color Misc::Color::fromHex(std::string_view)': ../../components/misc/color.cpp:36:24: error: 'v' may be used uninitialized in this function [-Werror=maybe-uninitialized] 36 | rgb[i] = v / 255.0f; | ~~^~~~~~~~ --- components/misc/color.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/misc/color.cpp b/components/misc/color.cpp index edf3435428..56520c5d74 100644 --- a/components/misc/color.cpp +++ b/components/misc/color.cpp @@ -29,7 +29,7 @@ namespace Misc for (size_t i = 0; i < rgb.size(); i++) { auto sub = hex.substr(i * 2, 2); - int v; + int v = 0; auto [_, ec] = std::from_chars(sub.data(), sub.data() + sub.size(), v, 16); if (ec != std::errc()) throw std::logic_error(std::string("Invalid hex color: ") += hex);