check if newlibadr returns a valid pointer when running do-versions on animviz data
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jan 2010 14:22:22 +0000 (14:22 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jan 2010 14:22:22 +0000 (14:22 +0000)
source/blender/blenloader/intern/readfile.c

index 69186432d64a58ed92076304d5edfef52f3df28f..4165d2860a49a5fe95db876fbefb0467998e688d 100644 (file)
@@ -10339,47 +10339,49 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        /* if armature, copy settings for pose from armature data */
                        if (ob->pose && ob->data) {
                                bArmature *arm= newlibadr(fd, lib, ob->data);
-                               bAnimVizSettings *avs= &ob->pose->avs;
-                               
-                               /* ghosting settings ---------------- */
-                                       /* ranges */
-                               avs->ghost_bc= avs->ghost_ac= arm->ghostep;
-                               
-                               avs->ghost_sf= arm->ghostsf;
-                               avs->ghost_ef= arm->ghostef;
-                                       
-                                       /* type */
-                               avs->ghost_type= arm->ghosttype;
-                                       
-                                       /* stepsize */
-                               avs->ghost_step= arm->ghostsize;
-                               
-                               /* path settings --------------------- */
-                                       /* ranges */
-                               avs->path_bc= arm->pathbc;
-                               avs->path_ac= arm->pathac;
-                               
-                               avs->path_sf= arm->pathsf;
-                               avs->path_ef= arm->pathef;
-                               
-                                       /* flags */
-                               if (arm->pathflag & ARM_PATH_FNUMS)
-                                       avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
-                               if (arm->pathflag & ARM_PATH_KFRAS)
-                                       avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
-                               if (arm->pathflag & ARM_PATH_KFNOS)
-                                       avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
-                                       
-                                       /* bake flags */
-                               if (arm->pathflag & ARM_PATH_HEADS)
-                                       avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
-                                       
-                                       /* type */
-                               if (arm->pathflag & ARM_PATH_ACFRA)
-                                       avs->path_type = MOTIONPATH_TYPE_ACFRA;
-                               
-                                       /* stepsize */
-                               avs->path_step= arm->pathsize;
+                               if(arm) { /* XXX - why does this fail in some cases? */
+                                       bAnimVizSettings *avs= &ob->pose->avs;
+
+                                       /* ghosting settings ---------------- */
+                                               /* ranges */
+                                       avs->ghost_bc= avs->ghost_ac= arm->ghostep;
+
+                                       avs->ghost_sf= arm->ghostsf;
+                                       avs->ghost_ef= arm->ghostef;
+
+                                               /* type */
+                                       avs->ghost_type= arm->ghosttype;
+
+                                               /* stepsize */
+                                       avs->ghost_step= arm->ghostsize;
+
+                                       /* path settings --------------------- */
+                                               /* ranges */
+                                       avs->path_bc= arm->pathbc;
+                                       avs->path_ac= arm->pathac;
+
+                                       avs->path_sf= arm->pathsf;
+                                       avs->path_ef= arm->pathef;
+
+                                               /* flags */
+                                       if (arm->pathflag & ARM_PATH_FNUMS)
+                                               avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
+                                       if (arm->pathflag & ARM_PATH_KFRAS)
+                                               avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
+                                       if (arm->pathflag & ARM_PATH_KFNOS)
+                                               avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
+
+                                               /* bake flags */
+                                       if (arm->pathflag & ARM_PATH_HEADS)
+                                               avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
+
+                                               /* type */
+                                       if (arm->pathflag & ARM_PATH_ACFRA)
+                                               avs->path_type = MOTIONPATH_TYPE_ACFRA;
+
+                                               /* stepsize */
+                                       avs->path_step= arm->pathsize;
+                               }
                        }
                }