Commit c64770b9 authored by Nikolai Krasheninnikov's avatar Nikolai Krasheninnikov
Browse files

Fix 'SVN Log...' crash while watching history in the unversioned directory....

Fix 'SVN Log...' crash while watching history in the unversioned directory. Added checks m_log variable contains anything.

Summary:
This commits adds checks of m_log variable contains anything before using it.
More appropriate is not showing 'SVN Log...' as available action at all, this should go in a further commits.
Anyway checks for a m_log variable is a must.

Test Plan: Run 'SVN Log...' in unversioned directory make sure it doesn't crash any more and showes empty history.

Reviewers: #dolphin, meven, elvisangelaccio

Reviewed By: #dolphin, meven, elvisangelaccio

Differential Revision: https://phabricator.kde.org/D29043
parent b72e20c5
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
* absolute paths accepted). Log starts from revision \p fromRevision and goes for \p maxEntries * absolute paths accepted). Log starts from revision \p fromRevision and goes for \p maxEntries
* previous revisions. The default revision (0) means current revision. * previous revisions. The default revision (0) means current revision.
* *
* \return Full log, empty QVector in case of error. * \return Full log, nullptr in case of error.
* *
* \note This function is really time consuming. * \note This function is really time consuming.
*/ */
......
...@@ -147,6 +147,10 @@ SvnLogDialog::~SvnLogDialog() = default; ...@@ -147,6 +147,10 @@ SvnLogDialog::~SvnLogDialog() = default;
void SvnLogDialog::setCurrentRevision(ulong revision) void SvnLogDialog::setCurrentRevision(ulong revision)
{ {
if (m_log.isNull()) {
return;
}
for (int i = 0; i < m_log->size(); ++i) { for (int i = 0; i < m_log->size(); ++i) {
if (m_log->at(i).revision == revision) { if (m_log->at(i).revision == revision) {
QFont font; QFont font;
...@@ -165,6 +169,11 @@ void SvnLogDialog::setCurrentRevision(ulong revision) ...@@ -165,6 +169,11 @@ void SvnLogDialog::setCurrentRevision(ulong revision)
void SvnLogDialog::refreshLog() void SvnLogDialog::refreshLog()
{ {
m_log = SvnCommands::getLog(m_contextDir, m_logLength); m_log = SvnCommands::getLog(m_contextDir, m_logLength);
if (m_log.isNull()) {
return;
}
m_ui.tLog->clearContents(); m_ui.tLog->clearContents();
m_ui.teMessage->clear(); m_ui.teMessage->clear();
m_ui.lPaths->clear(); m_ui.lPaths->clear();
...@@ -196,6 +205,9 @@ void SvnLogDialog::on_tLog_currentCellChanged(int currentRow, int currentColumn, ...@@ -196,6 +205,9 @@ void SvnLogDialog::on_tLog_currentCellChanged(int currentRow, int currentColumn,
if (currentRow < 0) { if (currentRow < 0) {
return; return;
} }
if (m_log.isNull()) {
return;
}
if (m_log->size() < currentRow) { if (m_log->size() < currentRow) {
return; return;
} }
......
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