[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kalarm] src: Check for invalid filename or non-existent local file
From:       David Jarvie <djarvie () kde ! org>
Date:       2016-09-21 21:17:33
Message-ID: E1bmotZ-00041o-W9 () code ! kde ! org
[Download RAW message or body]

Git commit 7d2ea8785561c44cb8b0b47c26985f40355d3e5a by David Jarvie.
Committed on 21/09/2016 at 21:14.
Pushed by djarvie into branch 'master'.

Check for invalid filename or non-existent local file

M  +6    -3    src/functions.cpp

http://commits.kde.org/kalarm/7d2ea8785561c44cb8b0b47c26985f40355d3e5a

diff --git a/src/functions.cpp b/src/functions.cpp
index 08bc9dc..ee92663 100644
--- a/src/functions.cpp
+++ b/src/functions.cpp
@@ -1626,14 +1626,17 @@ FileType fileType(const QMimeType& mimetype)
 FileErr checkFileExists(QString& filename, QUrl& url)
 {
     // Convert any relative file path to absolute
-    // (using home directory as the default)
-    // This also supports absolute paths and absolute urls
-    url = QUrl::fromUserInput(filename, QDir::homePath());
+    // (using home directory as the default).
+    // This also supports absolute paths and absolute urls.
     FileErr err = FileErr_None;
+    url = QUrl::fromUserInput(filename, QDir::homePath());
     if (filename.isEmpty())
     {
+        url = QUrl();
         err = FileErr_Blank;    // blank file name
     }
+    else if (!url.isValid())
+        err = FileErr_Nonexistent;
     else if (!url.isLocalFile())
     {
         filename = url.toDisplayString();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic