Fixed: Don't try to use a directory if empty

This commit is contained in:
kervala 2016-06-12 14:18:36 +02:00
parent 218bc058d0
commit 5c69240979
3 changed files with 23 additions and 11 deletions

View file

@ -502,6 +502,8 @@ bool CConfigFile::isRyzomInstalledIn(const QString &directory) const
bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
{ {
if (directory.isEmpty()) return false;
QDir dir(directory); QDir dir(directory);
// directory doesn't exist // directory doesn't exist
@ -528,6 +530,8 @@ bool CConfigFile::areRyzomDataInstalledIn(const QString &directory) const
bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
{ {
if (directory.isEmpty()) return false;
QDir dir(directory); QDir dir(directory);
// directory doesn't exist // directory doesn't exist
@ -557,6 +561,8 @@ bool CConfigFile::isRyzomClientInstalledIn(const QString &directory) const
bool CConfigFile::foundTemporaryFiles(const QString &directory) const bool CConfigFile::foundTemporaryFiles(const QString &directory) const
{ {
if (directory.isEmpty()) return false;
QDir dir(directory); QDir dir(directory);
// directory doesn't exist // directory doesn't exist

View file

@ -52,6 +52,8 @@ void CFilesCleaner::setDirectory(const QString &src)
bool CFilesCleaner::exec() bool CFilesCleaner::exec()
{ {
if (m_directory.isEmpty()) return false;
if (m_listener) m_listener->operationPrepare(); if (m_listener) m_listener->operationPrepare();
QDir dir(m_directory); QDir dir(m_directory);

View file

@ -37,6 +37,9 @@ QString qBytesToHumanReadable(qint64 bytes)
qint64 getDirectorySize(const QString &directory) qint64 getDirectorySize(const QString &directory)
{ {
qint64 size = 0; qint64 size = 0;
if (!directory.isEmpty())
{
QDir dir(directory); QDir dir(directory);
if (dir.exists()) if (dir.exists())
@ -57,6 +60,7 @@ qint64 getDirectorySize(const QString &directory)
} }
} }
} }
}
return size; return size;
} }