summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx/PortableImageLoaderCommon.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGfx/PortableImageLoaderCommon.h')
-rw-r--r--Libraries/LibGfx/PortableImageLoaderCommon.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/Libraries/LibGfx/PortableImageLoaderCommon.h b/Libraries/LibGfx/PortableImageLoaderCommon.h
index b5b1c5e91f..5f3c51679c 100644
--- a/Libraries/LibGfx/PortableImageLoaderCommon.h
+++ b/Libraries/LibGfx/PortableImageLoaderCommon.h
@@ -294,12 +294,10 @@ static RefPtr<Gfx::Bitmap> load_impl(const u8* data, size_t data_size)
template<typename TContext>
static RefPtr<Gfx::Bitmap> load(const StringView& path)
{
- MappedFile mapped_file(path);
- if (!mapped_file.is_valid()) {
+ auto file_or_error = MappedFile::map(path);
+ if (file_or_error.is_error())
return nullptr;
- }
-
- auto bitmap = load_impl<TContext>((const u8*)mapped_file.data(), mapped_file.size());
+ auto bitmap = load_impl<TContext>((const u8*)file_or_error.value()->data(), file_or_error.value()->size());
if (bitmap)
bitmap->set_mmap_name(String::formatted("Gfx::Bitmap [{}] - Decoded {}: {}",
bitmap->size(),