1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-24 16:12:11 +00:00

LibPDF: Replace two TODO()s with Error returns

That way, we render an incomplete page and log a message instead of
crashing the viewer application.

Lets us survive e.g. page 489 of pdf_reference_1-7.pdf.
This commit is contained in:
Nico Weber 2023-07-23 10:44:52 -04:00 committed by Tim Flynn
parent 268355c759
commit 7b825fb44b

View file

@ -40,7 +40,7 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> ColorSpace::create(DeprecatedFlyString con
if (name == CommonNames::DeviceCMYK) if (name == CommonNames::DeviceCMYK)
return DeviceCMYKColorSpace::the(); return DeviceCMYKColorSpace::the();
if (name == CommonNames::Pattern) if (name == CommonNames::Pattern)
TODO(); return Error::rendering_unsupported_error("Pattern color spaces not yet implemented");
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
@ -60,7 +60,7 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> ColorSpace::create(Document* document, Non
return TRY(ICCBasedColorSpace::create(document, move(parameters))); return TRY(ICCBasedColorSpace::create(document, move(parameters)));
dbgln("Unknown color space: {}", color_space_name); dbgln("Unknown color space: {}", color_space_name);
TODO(); return Error::rendering_unsupported_error("unknown color space");
} }
NonnullRefPtr<DeviceGrayColorSpace> DeviceGrayColorSpace::the() NonnullRefPtr<DeviceGrayColorSpace> DeviceGrayColorSpace::the()