2.5 - Fixed crashes when merging areas
authorJoshua Leung <aligorith@gmail.com>
Sun, 14 Dec 2008 09:11:31 +0000 (09:11 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 14 Dec 2008 09:11:31 +0000 (09:11 +0000)
source/blender/blenkernel/intern/screen.c

index 2831f45195eb54dbfc7941f9d594704b24bfaee9..c7379f61870a3af7c6b427dd1f1b1ab9c297a504 100644 (file)
@@ -135,17 +135,19 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
 /* not region itself */
 void BKE_area_region_free(ARegion *ar)
 {
-       if(ar->type && ar->type->free)
+       if(ar && ar->type && ar->type->free)
                ar->type->free(ar);
 }
 
 /* not area itself */
 void BKE_screen_area_free(ScrArea *sa)
 {
-       ARegion *ar;
+       ARegion *ar, *arn;
        
-       for(ar=sa->regionbase.first; ar; ar=ar->next)
+       for(ar=sa->regionbase.first; ar; ar=arn) {
+               arn= ar->next;
                BKE_area_region_free(ar);
+       }
 
        BKE_spacedata_freelist(&sa->spacedata);