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

Authored by nikolaik on Apr 21 2020, 10:12 AM.

Details

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.

Diff Detail

Repository
R449 Plugins for Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nikolaik requested review of this revision.Apr 21 2020, 10:12 AM
nikolaik created this revision.
nikolaik edited the test plan for this revision. (Show Details)

I would have updated static QSharedPointer< QVector<logEntry> > getLog(const QString& filePath, uint maxEntries = 255, ulong fromRevision = 0); to match its documentation instead

I would have updated static QSharedPointer< QVector<logEntry> > getLog(const QString& filePath, uint maxEntries = 255, ulong fromRevision = 0); to match its documentation instead

Can you please explain what do you mean? The documentation is also fixed and i think is correct now.

I would have updated static QSharedPointer< QVector<logEntry> > getLog(const QString& filePath, uint maxEntries = 255, ulong fromRevision = 0); to match its documentation instead

Can you please explain what do you mean? The documentation is also fixed and i think is correct now.

Returning an empty QVector instead of null in getLog would have sufficed and would be somewhat safer as the documentation suggested it did, but didn't.
Anyway that's not very important.

nikolaik added a comment.EditedApr 21 2020, 12:30 PM

I would have updated static QSharedPointer< QVector<logEntry> > getLog(const QString& filePath, uint maxEntries = 255, ulong fromRevision = 0); to match its documentation instead

Can you please explain what do you mean? The documentation is also fixed and i think is correct now.

Returning an empty QVector instead of null in getLog would have sufficed and would be somewhat safer as the documentation suggested it did, but didn't.
Anyway that's not very important.

True, but there is one case where empty history is not an error: just created repository.
Returning a nullptr covers this case.

meven accepted this revision.Apr 21 2020, 1:08 PM
This revision is now accepted and ready to land.Apr 21 2020, 1:08 PM
elvisangelaccio accepted this revision.Apr 26 2020, 9:44 PM
This revision was automatically updated to reflect the committed changes.

@meven i pushed this myself as everyone accepted it but commit is missing at the github mirror https://github.com/KDE/dolphin-plugins
i did something wrong?

@meven i pushed this myself as everyone accepted it but commit is missing at the github mirror https://github.com/KDE/dolphin-plugins
i did something wrong?

It is here source of truth is cgit.kde.org (soon to be invent.kde.org)
https://cgit.kde.org/dolphin-plugins.git/commit/?id=c64770b95b6b52e5fd7d74452477fca612fb22d3

The mirroring probably just lags a little.