diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index c779a3604f..4747b277ee 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -49,8 +49,7 @@ public: return static_cast(m_paged_errors.size()); } if (!index.parent().is_valid()) { - auto errors_in_page = m_paged_errors.get(index.row()).release_value().size(); - return static_cast(errors_in_page); + return static_cast(error_count_in_page(index)); } return 0; } @@ -103,7 +102,7 @@ public: case Columns::Page: return m_pages_with_errors[index.row()] + 1; case Columns::Message: - return DeprecatedString::formatted("{} errors", m_paged_errors.get(index.row()).release_value().size()); + return DeprecatedString::formatted("{} errors", error_count_in_page(index)); default: VERIFY_NOT_REACHED(); } @@ -149,6 +148,13 @@ private: return count; } + size_t error_count_in_page(GUI::ModelIndex const& index) const + { + VERIFY(!index.parent().is_valid()); + auto page = m_pages_with_errors[index.row()]; + return m_paged_errors.get(page).release_value().size(); + } + Vector m_pages_with_errors; PagedErrors m_paged_errors; };