1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:47:35 +00:00

LibELF: Remove sketchy use of "undefined" ELF::Image::Section

We were using ELF::Image::section(0) to indicate the "undefined"
section, when what we really wanted was just Optional<Section>.

So let's use Optional instead. :^)
This commit is contained in:
Andreas Kling 2021-05-15 00:13:44 +02:00
parent f70d0f03de
commit 16221305ad
6 changed files with 18 additions and 19 deletions

View file

@ -176,10 +176,10 @@ Icon FileIconProvider::icon_for_executable(const String& path)
auto section = image.lookup_section(icon_section.section_name);
RefPtr<Gfx::Bitmap> bitmap;
if (section.is_undefined()) {
if (!section.has_value()) {
bitmap = s_executable_icon.bitmap_for_size(icon_section.image_size);
} else {
bitmap = Gfx::load_png_from_memory(reinterpret_cast<const u8*>(section.raw_data()), section.size());
bitmap = Gfx::load_png_from_memory(reinterpret_cast<u8 const*>(section->raw_data()), section->size());
}
if (!bitmap) {