Sound engine: don't open() inexistent files
Avoid error “QIODevice::read: device not open”
This commit is contained in:
parent
757795f7cd
commit
399886c25c
1 changed files with 2 additions and 0 deletions
|
@ -22,6 +22,8 @@ void SoundEngine::cacheData()
|
||||||
<< "notification" << "draw" << "playcard" << "shuffle" << "tap" << "untap" << "cuckoo";
|
<< "notification" << "draw" << "playcard" << "shuffle" << "tap" << "untap" << "cuckoo";
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw");
|
QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw");
|
||||||
|
if(!file.exists())
|
||||||
|
continue;
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
audioData.insert(fileNames[i], file.readAll());
|
audioData.insert(fileNames[i], file.readAll());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
Loading…
Reference in a new issue