From 0a00f13bf246d37182dafcd053776048f63d2299 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 27 Apr 2012 09:28:00 +0200 Subject: Never pass null-items to version-control-plugins Some plugins are not prepared for this and might crash. Although the additional check in VersionControlObserver::actions() should not be necessary because of the fix in DolphinView, it is left here to catch potential other cases where a null-item might get passed accidently. Thanks to Ilya for initially patching the Box-plugin which gave a hint whats going wrong. BUG: 294336 FIXED-IN: 4.9.0 --- src/views/versioncontrol/versioncontrolobserver.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/views/versioncontrol/versioncontrolobserver.cpp') diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index bbabd2e4e..42e00de42 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -90,7 +90,17 @@ KFileItemModel* VersionControlObserver::model() const QList VersionControlObserver::actions(const KFileItemList& items) const { QList actions; - if (!m_model) { + + bool hasNullItems = false; + foreach (const KFileItem& item, items) { + if (item.isNull()) { + kWarning() << "Requesting version-control-actions for empty items"; + hasNullItems = true; + break; + } + } + + if (!m_model || hasNullItems) { return actions; } -- cgit v1.3