From 45852209574fed57c80ada773f6353a09fc8cdd1 Mon Sep 17 00:00:00 2001 From: Fabian Gundlach Date: Thu, 25 May 2023 14:05:51 +0200 Subject: [PATCH] Fix "unlink views" when the document is empty --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bba9b9d..c8b9d47 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -959,7 +959,8 @@ void MainWindow::setLinkedPages(bool on) { if (m_views_linked) { // Try to keep the focused view the same and change other views. // This might be impossible if there are too few pages before or after the focused page. - showPages(assign_pages_linked_fixing_one_view(doc->pages().size(), focused_view, page_numbers[focused_view]), focused_view); + if (focused_view != -1) + showPages(assign_pages_linked_fixing_one_view(doc->pages().size(), focused_view, page_numbers[focused_view]), focused_view); } else { // Try to keep everything as is, but display the last page in all empty views, assuming the document is nonempty. std::array res = page_numbers;