Check that QIODevice::open() is successful, and explicitly call close()
This commit is contained in:
@@ -63,15 +63,15 @@ SongList ASXParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
}
|
||||
|
||||
QBuffer buffer(&data);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
|
||||
SongList ret;
|
||||
if (!buffer.open(QIODevice::ReadOnly)) return SongList();
|
||||
|
||||
QXmlStreamReader reader(&buffer);
|
||||
if (!Utilities::ParseUntilElementCI(&reader, "asx")) {
|
||||
return ret;
|
||||
buffer.close();
|
||||
return SongList();
|
||||
}
|
||||
|
||||
SongList ret;
|
||||
while (!reader.atEnd() && Utilities::ParseUntilElementCI(&reader, "entry")) {
|
||||
Song song = ParseTrack(&reader, dir, collection_search);
|
||||
if (song.is_valid()) {
|
||||
@@ -79,6 +79,8 @@ SongList ASXParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
}
|
||||
}
|
||||
|
||||
buffer.close();
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user