Skip to content

Commit

Permalink
Fix for coverity #29360
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Feb 23, 2015
1 parent 1b11867 commit 0ebb403
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/audio/sound_file.cpp
Expand Up @@ -83,7 +83,12 @@ std::unique_ptr<SoundFile> load_sound_file(const std::string& filename)
char magic[4];
if(PHYSFS_read(file, magic, sizeof(magic), 1) != 1)
throw SoundError("Couldn't read magic, file too short");
PHYSFS_seek(file, 0);
if (PHYSFS_seek(file, 0) == 0) {
std::stringstream msg;
msg << "Couldn't seek through sound file: " << PHYSFS_getLastError();
throw SoundError(msg.str());
}

if(strncmp(magic, "RIFF", 4) == 0)
return std::unique_ptr<SoundFile>(new WavSoundFile(file));
else if(strncmp(magic, "OggS", 4) == 0)
Expand Down

0 comments on commit 0ebb403

Please sign in to comment.