diff --git a/Userland/Libraries/LibPDF/ColorSpace.cpp b/Userland/Libraries/LibPDF/ColorSpace.cpp index 7e89ff3c09..b0dc5598d5 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.cpp +++ b/Userland/Libraries/LibPDF/ColorSpace.cpp @@ -53,7 +53,7 @@ PDFErrorOr> ColorSpace::create(DeprecatedFlyString con if (name == CommonNames::DeviceRGB) return DeviceRGBColorSpace::the(); if (name == CommonNames::DeviceCMYK) - return DeviceCMYKColorSpace::the(); + return TRY(DeviceCMYKColorSpace::the()); if (name == CommonNames::Pattern) return Error::rendering_unsupported_error("Pattern color spaces not yet implemented"); VERIFY_NOT_REACHED(); @@ -134,7 +134,7 @@ Vector DeviceRGBColorSpace::default_decode() const return { 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }; } -NonnullRefPtr DeviceCMYKColorSpace::the() +ErrorOr> DeviceCMYKColorSpace::the() { static auto instance = adopt_ref(*new DeviceCMYKColorSpace()); return instance; diff --git a/Userland/Libraries/LibPDF/ColorSpace.h b/Userland/Libraries/LibPDF/ColorSpace.h index c3f9329d53..4b549ec6fe 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.h +++ b/Userland/Libraries/LibPDF/ColorSpace.h @@ -112,7 +112,7 @@ private: class DeviceCMYKColorSpace final : public ColorSpace { public: - static NonnullRefPtr the(); + static ErrorOr> the(); ~DeviceCMYKColorSpace() override = default; diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 8830143de2..e6ff7dfebc 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -695,14 +695,14 @@ RENDERER_HANDLER(set_painting_color_and_space_to_rgb) RENDERER_HANDLER(set_stroking_color_and_space_to_cmyk) { - state().stroke_color_space = DeviceCMYKColorSpace::the(); + state().stroke_color_space = TRY(DeviceCMYKColorSpace::the()); state().stroke_style = TRY(state().stroke_color_space->style(args)); return {}; } RENDERER_HANDLER(set_painting_color_and_space_to_cmyk) { - state().paint_color_space = DeviceCMYKColorSpace::the(); + state().paint_color_space = TRY(DeviceCMYKColorSpace::the()); state().paint_style = TRY(state().paint_color_space->style(args)); return {}; }