From bffd4da8b66bd8e72aae0302b7b70d5344a8578f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Sat, 24 Oct 2009 12:45:58 +0000 Subject: [PATCH] Return NULL/false rather than crash when accessing file attributes in FileRef BUG:209417 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039724 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/fileref.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp index 93a72407..e5d0feaf 100644 --- a/taglib/fileref.cpp +++ b/taglib/fileref.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "fileref.h" #include "asffile.h" @@ -93,11 +94,19 @@ FileRef::~FileRef() Tag *FileRef::tag() const { + if(isNull()) { + debug("FileRef::tag() - Called without a valid file."); + return 0; + } return d->file->tag(); } AudioProperties *FileRef::audioProperties() const { + if(isNull()) { + debug("FileRef::audioProperties() - Called without a valid file."); + return 0; + } return d->file->audioProperties(); } @@ -108,6 +117,10 @@ File *FileRef::file() const bool FileRef::save() { + if(isNull()) { + debug("FileRef::save() - Called without a valid file."); + return false; + } return d->file->save(); }