mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
PDFViewer: Propagate errors from OutlineModel construction
This follows the same idea that Andreas was doing in this latest videos, where construction-time TRY()s were not present but should have been. Like Andreas did, moving the initialisation of such fields to the factory function, which then returns ErrorOr solves the issue.
This commit is contained in:
parent
cb2cf6de99
commit
2ea8d2547e
4 changed files with 11 additions and 9 deletions
|
@ -376,11 +376,11 @@ PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(Core::File& file)
|
|||
|
||||
if (document->outline()) {
|
||||
auto outline = document->outline();
|
||||
m_sidebar->set_outline(outline.release_nonnull());
|
||||
TRY(m_sidebar->set_outline(outline.release_nonnull()));
|
||||
m_sidebar->set_visible(true);
|
||||
m_sidebar_open = true;
|
||||
} else {
|
||||
m_sidebar->set_outline({});
|
||||
TRY(m_sidebar->set_outline({}));
|
||||
m_sidebar->set_visible(false);
|
||||
m_sidebar_open = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue