From 35cdcd3b958460dfe6da40ff68f673d1fdca1aaf Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Sat, 22 Jun 2013 16:12:57 +0900 Subject: [PATCH] Added a missing check if an Opus file is open --- taglib/ogg/opus/opusfile.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/taglib/ogg/opus/opusfile.cpp b/taglib/ogg/opus/opusfile.cpp index 8d3af7af..91ec5a09 100644 --- a/taglib/ogg/opus/opusfile.cpp +++ b/taglib/ogg/opus/opusfile.cpp @@ -59,18 +59,20 @@ public: // public members //////////////////////////////////////////////////////////////////////////////// -Opus::File::File(FileName file, bool readProperties, - Properties::ReadStyle propertiesStyle) : Ogg::File(file) +Opus::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle) + : Ogg::File(file) + , d(new FilePrivate()) { - d = new FilePrivate; - read(readProperties, propertiesStyle); + if(isOpen()) + read(readProperties, propertiesStyle); } -Opus::File::File(IOStream *stream, bool readProperties, - Properties::ReadStyle propertiesStyle) : Ogg::File(stream) +Opus::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) + : Ogg::File(stream) + , d(new FilePrivate()) { - d = new FilePrivate; - read(readProperties, propertiesStyle); + if(isOpen()) + read(readProperties, propertiesStyle); } Opus::File::~File()