From 937d018fc61a54199619605101b7d9abbfc5dd94 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 19 Feb 2023 07:07:58 -0500 Subject: [PATCH] LibGfx: Use ICC::Profile::try_for_each_tag in encode_tag_datas() --- Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp b/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp index 22841e4624..5aa810cb01 100644 --- a/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp +++ b/Userland/Libraries/LibGfx/ICC/BinaryWriter.cpp @@ -305,14 +305,14 @@ static ErrorOr> encode_tag_datas(Profile const& profile, Hash Vector tag_data_bytes; TRY(tag_data_bytes.try_ensure_capacity(profile.tag_count())); - profile.for_each_tag([&](auto, auto tag_data) { + TRY(profile.try_for_each_tag([&](auto, auto tag_data) -> ErrorOr { if (tag_data_map.contains(tag_data.ptr())) - return; + return {}; - // FIXME: Come up with a way to allow TRY instead of MUST here. - tag_data_bytes.append(MUST(encode_tag_data(tag_data))); - MUST(tag_data_map.try_set(tag_data.ptr(), tag_data_bytes.size() - 1)); - }); + tag_data_bytes.append(TRY(encode_tag_data(tag_data))); + TRY(tag_data_map.try_set(tag_data.ptr(), tag_data_bytes.size() - 1)); + return {}; + })); return tag_data_bytes; }