mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibPDF: Harden the document/parser against errors
This commit is contained in:
parent
d654fe0e41
commit
1ef5071d1b
6 changed files with 217 additions and 108 deletions
|
@ -105,7 +105,9 @@ void PDFViewerWidget::open_file(const String& path)
|
|||
auto file_result = Core::File::open(path, Core::OpenMode::ReadOnly);
|
||||
VERIFY(!file_result.is_error());
|
||||
m_buffer = file_result.value()->read_all();
|
||||
auto document = adopt_ref(*new PDF::Document(m_buffer));
|
||||
auto document = PDF::Document::create(m_buffer);
|
||||
// FIXME: Show error dialog if the Document is invalid
|
||||
VERIFY(document);
|
||||
m_viewer->set_document(document);
|
||||
m_total_page_label->set_text(String::formatted("of {}", document->get_page_count()));
|
||||
m_total_page_label->set_fixed_width(30);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue