file->seek(first + 4);
d->xingHeader = new XingHeader(file->readBlock(firstHeader.frameLength() - 4));
+ if(!d->xingHeader->isValid()) {
+ delete d->xingHeader;
+ d->xingHeader = 0;
+ }
- if(d->xingHeader->isValid() &&
- firstHeader.samplesPerFrame() > 0 &&
- firstHeader.sampleRate() > 0) {
+ if(d->xingHeader && firstHeader.samplesPerFrame() > 0 && firstHeader.sampleRate() > 0) {
// Read the length and the bitrate from the VBR header.
CPPUNIT_ASSERT_EQUAL(64, f.audioProperties()->bitrate());
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->channels());
CPPUNIT_ASSERT_EQUAL(44100, f.audioProperties()->sampleRate());
- CPPUNIT_ASSERT(!f.audioProperties()->xingHeader()->isValid());
+ CPPUNIT_ASSERT(!f.audioProperties()->xingHeader());
long last = f.lastFrameOffset();