comparison data/model/WaveFileModel.cpp @ 292:8c5762634f42

* avoid crash if m_reader is null
author Chris Cannam
date Fri, 24 Aug 2007 14:45:29 +0000
parents 92e8dbde73cd
children c022976d18e8
comparison
equal deleted inserted replaced
291:42e6c8360df1 292:8c5762634f42
45 m_updateTimer(0), 45 m_updateTimer(0),
46 m_lastFillExtent(0), 46 m_lastFillExtent(0),
47 m_exiting(false) 47 m_exiting(false)
48 { 48 {
49 m_reader = AudioFileReaderFactory::createReader(path); 49 m_reader = AudioFileReaderFactory::createReader(path);
50 setObjectName(m_reader->getTitle()); 50 if (m_reader) setObjectName(m_reader->getTitle());
51 if (objectName() == "") setObjectName(QFileInfo(path).fileName()); 51 if (objectName() == "") setObjectName(QFileInfo(path).fileName());
52 if (isOK()) fillCache(); 52 if (isOK()) fillCache();
53 } 53 }
54 54
55 WaveFileModel::WaveFileModel(QString path, QString originalLocation) : 55 WaveFileModel::WaveFileModel(QString path, QString originalLocation) :
59 m_updateTimer(0), 59 m_updateTimer(0),
60 m_lastFillExtent(0), 60 m_lastFillExtent(0),
61 m_exiting(false) 61 m_exiting(false)
62 { 62 {
63 m_reader = AudioFileReaderFactory::createReader(path); 63 m_reader = AudioFileReaderFactory::createReader(path);
64 setObjectName(m_reader->getTitle()); 64 if (m_reader) setObjectName(m_reader->getTitle());
65 if (objectName() == "") setObjectName(QFileInfo(originalLocation).fileName()); 65 if (objectName() == "") setObjectName(QFileInfo(originalLocation).fileName());
66 if (isOK()) fillCache(); 66 if (isOK()) fillCache();
67 } 67 }
68 68
69 WaveFileModel::WaveFileModel(QString path, AudioFileReader *reader) : 69 WaveFileModel::WaveFileModel(QString path, AudioFileReader *reader) :
73 m_updateTimer(0), 73 m_updateTimer(0),
74 m_lastFillExtent(0), 74 m_lastFillExtent(0),
75 m_exiting(false) 75 m_exiting(false)
76 { 76 {
77 m_reader = reader; 77 m_reader = reader;
78 setObjectName(m_reader->getTitle()); 78 if (m_reader) setObjectName(m_reader->getTitle());
79 if (objectName() == "") setObjectName(QFileInfo(path).fileName()); 79 if (objectName() == "") setObjectName(QFileInfo(path).fileName());
80 fillCache(); 80 fillCache();
81 } 81 }
82 82
83 WaveFileModel::~WaveFileModel() 83 WaveFileModel::~WaveFileModel()