diff options
| author | 2015-12-12 15:56:29 -0500 | |
|---|---|---|
| committer | 2015-12-12 16:09:32 -0500 | |
| commit | 3de7db7677136aa2852d028c021324d056f92810 (patch) | |
| tree | f67806b63ef1bd3a1716ea105a8f3a722c877d75 /src | |
| parent | Merge pull request #1764 from AlexanderP/travis_debian (diff) | |
| download | KVIrc-3de7db7677136aa2852d028c021324d056f92810.tar.gz KVIrc-3de7db7677136aa2852d028c021324d056f92810.tar.bz2 KVIrc-3de7db7677136aa2852d028c021324d056f92810.zip | |
editor: Don't call methods from null pointers
Also don't assume data that isn't there anymore.
Fixes #1766
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/KviMaskEditor.cpp | 7 | ||||
| -rw-r--r-- | src/kvirc/ui/KviModeEditor.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/kvirc/ui/KviMaskEditor.cpp b/src/kvirc/ui/KviMaskEditor.cpp index 6b1fedba8..7d92ca3c7 100644 --- a/src/kvirc/ui/KviMaskEditor.cpp +++ b/src/kvirc/ui/KviMaskEditor.cpp @@ -214,6 +214,13 @@ KviMaskEditor::KviMaskEditor(QWidget * par,KviChannelWindow * pChannel,KviWindow g->setColumnStretch(1,1); + if(!m_pChannel->connection()) + { + m_pRemoveMask->setEnabled(false); + m_pAddButton->setEnabled(false); + return; + } + for(KviMaskEntry * e = maskList->first();e;e = maskList->next()) addMask(e); updateOpStatus(); diff --git a/src/kvirc/ui/KviModeEditor.cpp b/src/kvirc/ui/KviModeEditor.cpp index e3488799c..a6bb7266f 100644 --- a/src/kvirc/ui/KviModeEditor.cpp +++ b/src/kvirc/ui/KviModeEditor.cpp @@ -60,6 +60,9 @@ KviModeEditor::KviModeEditor(QWidget * par,KviWindowToolPageButton* button,const pMasterLayout->addWidget(m_pButton,1,0); connect(m_pButton,SIGNAL(clicked()),this,SLOT(commit())); + if(!m_pChannel || !m_pChannel->connection()) + m_pButton->setText(__tr2qs("Close")); + QWidget * pBackground = new QWidget(pScrollArea->viewport()); QGridLayout *g = new QGridLayout(pBackground); @@ -85,6 +88,10 @@ KviModeEditor::KviModeEditor(QWidget * par,KviWindowToolPageButton* button,const //NOTE: this is a fallback is for some reason we don't have a serverInfo() struct available fot this connection + // The connection is dead and the context was destroyed, don't guess on what was there + if(!m_pChannel || !m_pChannel->connection()) + return; + // first, the basic checkable modes pstnmi QString szModes = "pstnmi"; |
