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
 // cast a generic object to a midi file object
131
 // cast a generic object to a midi file object
132
 cmTlMidiFile_t*  _cmTlMidiFileObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
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
     if( errFl && p != NULL)
136
     if( errFl && p != NULL)
137
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
137
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
144
 // cast a generic object to a midi event object
144
 // cast a generic object to a midi event object
145
 cmTlMidiEvt_t*   _cmTlMidiEvtObjPtr(   _cmTl_t* p, cmTlObj_t* op, bool errFl )
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
     if( errFl && p != NULL )
149
     if( errFl && p != NULL )
150
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
150
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
157
 // case a generic object to an audio file object
157
 // case a generic object to an audio file object
158
 cmTlAudioFile_t* _cmTlAudioFileObjPtr( _cmTl_t* p, cmTlObj_t* op, bool errFl )
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
     if( errFl && p != NULL)
162
     if( errFl && p != NULL)
163
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
163
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
170
 // cast a generic object an audio event object to 
170
 // cast a generic object an audio event object to 
171
 cmTlAudioEvt_t*  _cmTlAudioEvtObjPtr(  _cmTl_t* p, cmTlObj_t* op, bool errFl )
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
     if( errFl && p != NULL)
175
     if( errFl && p != NULL)
176
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
176
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
183
 // cast a generic object to a marker object
183
 // cast a generic object to a marker object
184
 cmTlMarker_t*    _cmTlMarkerObjPtr(    _cmTl_t* p, cmTlObj_t* op, bool errFl )
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
     if( errFl && p != NULL)
188
     if( errFl && p != NULL)
189
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");
189
       cmErrMsg(&p->err,kTypeCvtFailTlRC,"A time line object type promotion failed.");

+ 1
- 1
app/cmTimeLine.h View File

161
 
161
 
162
   // Same as cmTimeLineXXXObjPtr() but does not generate an error when
162
   // Same as cmTimeLineXXXObjPtr() but does not generate an error when
163
   // 'op' does not point to the correct type. These function quietly
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
   cmTlMidiFile_t*  cmTlMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op );
165
   cmTlMidiFile_t*  cmTlMidiFileObjPtr(  cmTlH_t h, cmTlObj_t* op );
166
   cmTlAudioFile_t* cmTlAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op );
166
   cmTlAudioFile_t* cmTlAudioFileObjPtr( cmTlH_t h, cmTlObj_t* op );
167
   cmTlMidiEvt_t*   cmTlMidiEvtObjPtr(   cmTlH_t h, cmTlObj_t* op );
167
   cmTlMidiEvt_t*   cmTlMidiEvtObjPtr(   cmTlH_t h, cmTlObj_t* op );

Loading…
Cancel
Save