Browse Source

app/cmTimeLine.h/c : cMTlXXXObjPtr() now returns NULL if the 'op' arg. is NULL.

master
Kevin Larke 9 years ago
parent
commit
a89cadec84
2 changed files with 6 additions and 6 deletions
  1. 5
    5
      app/cmTimeLine.c
  2. 1
    1
      app/cmTimeLine.h

+ 5
- 5
app/cmTimeLine.c View File

@@ -131,7 +131,7 @@ unsigned _cmTlIdLabelToId( _cmTl_t* p, const cmChar_t* label )
131 131
 // cast a generic object to a midi file object
132 132
 cmTlMidiFile_t*  _cmTlMidiFileObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
133 133
 { 
134
-  if( op->typeId != kMidiFileTlId )
134
+  if( op==NULL || op->typeId != kMidiFileTlId )
135 135
   {
136 136
     if( errFl && p != NULL)
137 137
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
@@ -144,7 +144,7 @@ cmTlMidiFile_t*  _cmTlMidiFileObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
144 144
 // cast a generic object to a midi event object
145 145
 cmTlMidiEvt_t*   _cmTlMidiEvtObjPtr(   _cmTl_t* p, cmTlObj_t* op, bool errFl )
146 146
 { 
147
-  if( op->typeId != kMidiEvtTlId )
147
+  if( op==NULL || op->typeId != kMidiEvtTlId )
148 148
   {
149 149
     if( errFl && p != NULL )
150 150
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
@@ -157,7 +157,7 @@ cmTlMidiEvt_t*   _cmTlMidiEvtObjPtr(   _cmTl_t* p, cmTlObj_t* op, bool errFl )
157 157
 // case a generic object to an audio file object
158 158
 cmTlAudioFile_t* _cmTlAudioFileObjPtr( _cmTl_t* p, cmTlObj_t* op, bool errFl )
159 159
 { 
160
-  if( op->typeId != kAudioFileTlId )
160
+  if( op==NULL || op->typeId != kAudioFileTlId )
161 161
   {
162 162
     if( errFl && p != NULL)
163 163
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
@@ -170,7 +170,7 @@ cmTlAudioFile_t* _cmTlAudioFileObjPtr( _cmTl_t* p, cmTlObj_t* op, bool errFl )
170 170
 // cast a generic object an audio event object to 
171 171
 cmTlAudioEvt_t*  _cmTlAudioEvtObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
172 172
 { 
173
-  if( op->typeId != kAudioEvtTlId )
173
+  if( op==NULL || op->typeId != kAudioEvtTlId )
174 174
   {
175 175
     if( errFl && p != NULL)
176 176
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
@@ -183,7 +183,7 @@ cmTlAudioEvt_t*  _cmTlAudioEvtObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
183 183
 // cast a generic object to a marker object
184 184
 cmTlMarker_t*    _cmTlMarkerObjPtr(    _cmTl_t* p, cmTlObj_t* op, bool errFl )
185 185
 { 
186
-  if( op->typeId != kMarkerTlId )
186
+  if( op==NULL || op->typeId != kMarkerTlId )
187 187
   {
188 188
     if( errFl && p != NULL)
189 189
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");

+ 1
- 1
app/cmTimeLine.h View File

@@ -161,7 +161,7 @@ extern "C" {
161 161
 
162 162
   // Same as cmTimeLineXXXObjPtr() but does not generate an error when
163 163
   // 'op' does not point to the correct type. These function quietly
164
-  // return NULL if the requested type does not match.
164
+  // return NULL if the requested type does not match or 'op' == NULL.
165 165
   cmTlMidiFile_t*  cmTlMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op );
166 166
   cmTlAudioFile_t* cmTlAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op );
167 167
   cmTlMidiEvt_t*   cmTlMidiEvtObjPtr(   cmTlH_t h, cmTlObj_t* op );

Loading…
Cancel
Save