Commit 61d18f32 authored by Denis Falqueto's avatar Denis Falqueto Committed by Albert Astals Cid
Browse files

Checks if an optional field was instantiated before accessing it

The private field m_konsolewidget is initialized only on some specific cases, so it should be accessed with caution. But there are some places in witch it's being used without checking if it was instantiated or not. This patch fixes those accesses, by checking if it is instantiated or not.

This was laying around in reviewboard approved by Giorgos Tsiapaliokas but uncommited for 5 months

REVIEW: 110288
BUGS: 319291
parent e98d1bef
......@@ -270,7 +270,9 @@ void MainWindow::toggleActions()
//Until this issue is being fixed we are hiding the konsole previewer.
actionCollection()->action("konsole")->setVisible(false);
//we are hiding the konsole previewer UI.
m_konsoleWidget->setVisible(false);
if (m_konsoleWidget) {
m_konsoleWidget->setVisible(false);
}
}
}
......@@ -452,7 +454,9 @@ void MainWindow::saveEditorData()
void MainWindow::saveAndRefresh()
{
//in every new save clear the konsole.
m_konsoleWidget->clearOutput();
if (m_konsoleWidget) {
m_konsoleWidget->clearOutput();
}
saveEditorData();
if (m_previewerWidget) {
......
Supports Markdown
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