Commit 5a0ddef2 authored by Michael Reeves's avatar Michael Reeves

Don't try to set value unless scrollbar exists.

Mouse or key events can be sent before the scrollbars are setup properly.

BUG: 407829
FIXED-IN:1.8.2
parent fa6d0d8a
......@@ -318,8 +318,8 @@ class KDiff3App : public QSplitter
QSplitter* m_pMainSplitter;
QWidget* m_pMainWidget;
QWidget* m_pMergeWindowFrame;
ReversibleScrollBar* m_pHScrollBar;
QScrollBar* m_pDiffVScrollBar;
ReversibleScrollBar* m_pHScrollBar = nullptr;
QScrollBar* m_pDiffVScrollBar = nullptr;
QScrollBar* m_pMergeVScrollBar;
DiffTextWindow* m_pDiffTextWindow1;
......
......@@ -541,12 +541,12 @@ void KDiff3App::resizeMergeResultWindow()
void KDiff3App::scrollDiffTextWindow(int deltaX, int deltaY)
{
if(deltaY != 0)
if(deltaY != 0 && m_pDiffVScrollBar != nullptr)
{
m_pDiffVScrollBar->setValue(m_pDiffVScrollBar->value() + deltaY);
m_pOverview->setRange(m_pDiffVScrollBar->value(), m_pDiffVScrollBar->pageStep());
}
if(deltaX != 0)
if(deltaX != 0 && m_pHScrollBar != nullptr)
m_pHScrollBar->QScrollBar::setValue(m_pHScrollBar->value() + deltaX);
}
......@@ -958,15 +958,23 @@ void KDiff3App::keyPressEvent(QKeyEvent* keyEvent)
break;
case Qt::Key_Home:
if(bCtrl)
m_pDiffVScrollBar->setValue(0);
{
if(m_pDiffVScrollBar != nullptr) m_pDiffVScrollBar->setValue(0);
}
else
m_pHScrollBar->setValue(0);
{
if(m_pHScrollBar != nullptr) m_pHScrollBar->setValue(0);
}
break;
case Qt::Key_End:
if(bCtrl)
m_pDiffVScrollBar->setValue(m_pDiffVScrollBar->maximum());
{
if(m_pDiffVScrollBar != nullptr) m_pDiffVScrollBar->setValue(m_pDiffVScrollBar->maximum());
}
else
m_pHScrollBar->setValue(m_pHScrollBar->maximum());
{
if(m_pHScrollBar != nullptr) m_pHScrollBar->setValue(m_pHScrollBar->maximum());
}
break;
default:
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment