Fix own error w/ undefined behavior
authorCampbell Barton <ideasman42@gmail.com>
Mon, 13 Jun 2016 11:55:54 +0000 (21:55 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 13 Jun 2016 11:57:22 +0000 (21:57 +1000)
This happened to work for me but caused issues on OSX.

source/blender/blenkernel/intern/library_idmap.c

index fd78d9b23ce4ed58a2071f7bcdd31a1a33b18de6..66025c04332d058915f0f8eab8f4b6b86079c1c7 100644 (file)
@@ -88,8 +88,10 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain)
 
        int index = 0;
        while (index < MAX_LIBARRAY) {
-               id_map->type_maps[index].map = NULL;
-               id_map->type_maps[index].id_type = BKE_idcode_iter_step(&index);
+               struct IDNameLib_TypeMap *type_map = &id_map->type_maps[index];
+               type_map->map = NULL;
+               type_map->id_type = BKE_idcode_iter_step(&index);
+               BLI_assert(type_map->id_type != 0);
        }
        BLI_assert(index == MAX_LIBARRAY);