[Pkg-owncloud-commits] [owncloud-client] 161/484: FolderStatusModel: Check for null argument at start.

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit a203da39195e0a0a7e65c466171abd96e4214f7a
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Oct 7 17:59:33 2015 +0200

    FolderStatusModel: Check for null argument at start.
---
 src/gui/folderstatusmodel.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 0f2c96c..8730ab8 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -349,13 +349,21 @@ FolderStatusModel::SubFolderInfo* FolderStatusModel::infoForIndex(const QModelIn
 
 QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString& path) const
 {
+    if( !f ) {
+        return QModelIndex();
+    }
+
     int slashPos = path.lastIndexOf('/');
     if (slashPos == -1) {
         // first level folder
         for (int i = 0; i < _folders.size(); ++i) {
             if (_folders.at(i)._folder == f) {
+                if( path.isEmpty() ) { // the folder object
+                    return index(i, 0);
+                }
                 for (int j = 0; j < _folders.at(i)._subs.size(); ++j) {
-                    if (_folders.at(i)._subs.at(j)._name == path) {
+                    const QString subName = _folders.at(i)._subs.at(j)._name;
+                    if (subName == path) {
                         return index(j, 0, index(i));
                     }
                 }
@@ -499,6 +507,7 @@ void FolderStatusModel::fetchMore(const QModelIndex& parent)
     connect(job, SIGNAL(finishedWithError(QNetworkReply*)),
             this, SLOT(slotLscolFinishedWithError(QNetworkReply*)));
     job->start();
+
     QPersistentModelIndex persistentIndex(parent);
     job->setProperty(propertyParentIndexC , QVariant::fromValue(persistentIndex));
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list