浏览代码

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.
Nico Weber 2 年之前
父节点
当前提交
7b825fb44b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibPDF/ColorSpace.cpp

+ 2 - 2
Userland/Libraries/LibPDF/ColorSpace.cpp

@@ -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()