mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
Fix crash with empty state file
This commit is contained in:
@@ -1351,6 +1351,12 @@ void Bittorrent::enableLSD(bool b) {
|
|||||||
void Bittorrent::loadSessionState() {
|
void Bittorrent::loadSessionState() {
|
||||||
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
const QString state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
||||||
if(!QFile::exists(state_path)) return;
|
if(!QFile::exists(state_path)) return;
|
||||||
|
if(QFile(state_path).size() == 0) {
|
||||||
|
// Remove empty state file
|
||||||
|
QFile::remove(state_path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
#if LIBTORRENT_VERSION_MINOR > 14
|
||||||
std::vector<char> in;
|
std::vector<char> in;
|
||||||
if (load_file(state_path.toLocal8Bit().constData(), in) == 0)
|
if (load_file(state_path.toLocal8Bit().constData(), in) == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user