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>
This commit is contained in:
parent
52934d74be
commit
23207d1d23
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user