diff options
author | Sune Vuorela <sune@vuorela.dk> | 2018-12-16 13:52:45 +0100 |
---|---|---|
committer | Sune Vuorela <sune@vuorela.dk> | 2018-12-19 19:25:29 +0000 |
commit | 23207d1d2386d97b9d27f2af385d70f80c14ab95 (patch) | |
tree | abace6dd0df3b3b8028432f1c3a22c915153b870 /src/corelib/io | |
parent | 52934d74be7d882f3f584a348ce29bedff7fa7a7 (diff) |
Empty filenames does not exist
If empty paths is passed to the unix filesystem engine, we get a warning
about empty filename passed to function, before returning false. Fix
this by testing for empty string first, and don't send empty string to
file engine.
The current warning leads to code like
if (!filename.isEmpty() && QFile::exists(filename))
{
//
}
rather than the slightly cleaner
if (QFile::exists(filename))
{
//
}
Change-Id: I0207324889ec22e5a072c28d58337d117b0153b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 26078a6c71..185e061d8f 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -703,6 +703,8 @@ bool QFileInfo::exists() const */ bool QFileInfo::exists(const QString &file) { + if (file.isEmpty()) + return false; QFileSystemEntry entry(file); QFileSystemMetaData data; QAbstractFileEngine *engine = |