Bugfix #20664: NLA Editor - Hiding stuff causes instant crash ..
authorJoshua Leung <aligorith@gmail.com>
Sun, 24 Jan 2010 10:18:16 +0000 (10:18 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 24 Jan 2010 10:18:16 +0000 (10:18 +0000)
source/blender/editors/animation/anim_channels_edit.c

index 9c72ff1a41346ce4356db936097606f0f38e20e6..f756c5b3158640025e37b1ed4f0a92271c975af8 100644 (file)
@@ -372,6 +372,10 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
        bAnimListElem *ale, *match=NULL;
        int prevLevel=0, matchLevel=0;
        
        bAnimListElem *ale, *match=NULL;
        int prevLevel=0, matchLevel=0;
        
+       /* sanity check */
+       if (ELEM(NULL, anim_data, anim_data->first))
+               return;
+       
        /* find the channel that got changed */
        for (ale= anim_data->first; ale; ale= ale->next) {
                /* compare data, and type as main way of identifying the channel */
        /* find the channel that got changed */
        for (ale= anim_data->first; ale; ale= ale->next) {
                /* compare data, and type as main way of identifying the channel */
@@ -391,6 +395,11 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
        else {
                bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale_setting);
                
        else {
                bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale_setting);
                
+               if (acf == NULL) {
+                       printf("ERROR: no channel info for the changed channel \n");
+                       return;
+               }
+               
                /* get the level of the channel that was affected
                 *       - we define the level as simply being the offset for the start of the channel
                 */
                /* get the level of the channel that was affected
                 *       - we define the level as simply being the offset for the start of the channel
                 */
@@ -416,6 +425,10 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
                        bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
                        int level;
                        
                        bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
                        int level;
                        
+                       /* if no channel info was found, skip, since this type might not have any useful info */
+                       if (acf == NULL)
+                               continue;
+                       
                        /* get the level of the current channel traversed 
                         *       - we define the level as simply being the offset for the start of the channel
                         */
                        /* get the level of the current channel traversed 
                         *       - we define the level as simply being the offset for the start of the channel
                         */
@@ -445,6 +458,10 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
                        bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
                        int level;
                        
                        bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
                        int level;
                        
+                       /* if no channel info was found, skip, since this type might not have any useful info */
+                       if (acf == NULL)
+                               continue;
+                       
                        /* get the level of the current channel traversed 
                         *       - we define the level as simply being the offset for the start of the channel
                         */
                        /* get the level of the current channel traversed 
                         *       - we define the level as simply being the offset for the start of the channel
                         */