forked from qt-creator/qt-creator
Help: Fix crash with previous/next document in help mode
"Previous/next Open Document in History" crashed in help mode when only a single page is open. Disable the actions in this case, and add a guard that prevents setting the current page to an invalid index. Fixes: QDS-3743 Change-Id: I569292d8c348269dd12d2ebb089c03173cbd4bc2 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -934,7 +934,10 @@ void HelpWidget::updateCloseButton()
|
||||
{
|
||||
if (supportsPages()) {
|
||||
const bool closeOnReturn = LocalHelpManager::returnOnClose() && m_style == ModeWidget;
|
||||
m_closeAction->setEnabled(closeOnReturn || m_viewerStack->count() > 1);
|
||||
const bool hasMultiplePages = m_viewerStack->count() > 1;
|
||||
m_closeAction->setEnabled(closeOnReturn || hasMultiplePages);
|
||||
m_gotoPrevious->setEnabled(hasMultiplePages);
|
||||
m_gotoNext->setEnabled(hasMultiplePages);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -81,7 +81,9 @@ void OpenPagesSwitcher::gotoPreviousPage()
|
||||
void OpenPagesSwitcher::selectAndHide()
|
||||
{
|
||||
setVisible(false);
|
||||
emit setCurrentPage(m_openPagesWidget->currentIndex());
|
||||
QModelIndex index = m_openPagesWidget->currentIndex();
|
||||
if (index.isValid())
|
||||
emit setCurrentPage(index);
|
||||
}
|
||||
|
||||
void OpenPagesSwitcher::selectCurrentPage(int index)
|
||||
|
Reference in New Issue
Block a user