mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-05 15:55:45 +00:00
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; | ~~^~~~~~~~
This commit is contained in:
parent
70623d0b23
commit
b0f192d878
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user