diff --git a/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.cpp index a56f57907d..29da8cafd9 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.cpp @@ -136,13 +136,11 @@ static ErrorOr load_ico_directory(ICOLoadingContext& context) return {}; } -ErrorOr ICOImageDecoderPlugin::load_ico_bitmap(ICOLoadingContext& context, Optional index) +ErrorOr ICOImageDecoderPlugin::load_ico_bitmap(ICOLoadingContext& context) { VERIFY(context.state >= ICOLoadingContext::State::DirectoryDecoded); - size_t real_index = context.largest_index; - if (index.has_value()) - real_index = index.value(); + size_t const real_index = context.largest_index; if (real_index >= context.images.size()) return Error::from_string_literal("Index out of bounds"); @@ -213,7 +211,7 @@ ErrorOr ICOImageDecoderPlugin::frame(size_t index, Optiona if (m_context->state < ICOLoadingContext::State::BitmapDecoded) { // NOTE: This forces the chunk decoding to happen. - auto maybe_error = load_ico_bitmap(*m_context, {}); + auto maybe_error = load_ico_bitmap(*m_context); if (maybe_error.is_error()) { m_context->state = ICOLoadingContext::State::Error; return Error::from_string_literal("ICOImageDecoderPlugin: Decoding failed"); diff --git a/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.h b/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.h index 03c15304b5..d13487b97c 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.h +++ b/Userland/Libraries/LibGfx/ImageFormats/ICOLoader.h @@ -25,7 +25,7 @@ public: private: ICOImageDecoderPlugin(u8 const*, size_t); - static ErrorOr load_ico_bitmap(ICOLoadingContext& context, Optional index); + static ErrorOr load_ico_bitmap(ICOLoadingContext& context); OwnPtr m_context; };