Fix access to invalid data in Outliner tree building
Non-ID tree-elements would cast their data pointer to `ID *` and take the name and ID-Code from there. The name would actually be overridden a few lines later, so that didn't cause issues. But the ID-Code stored inside the tree element kept an undefined value. In practice that probably didn't cause many issues either, since it's just an undefined value that was very unlikely to take a valid 16-bit ID-code value, meaning ID-Code checks would simply fail as they should. Further there typically are other checks to see if the element actually represents an ID. However, in theory this may have caused a few random crashes or data-corruptions.
This commit is contained in:
parent
cf9275dd4e
commit
0c0bc61918
|
@ -965,7 +965,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
else if (ELEM(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
|
||||
/* pass */
|
||||
}
|
||||
else if (type == TSE_ANIM_DATA) {
|
||||
else if (ELEM(type, TSE_ANIM_DATA, TSE_NLA, TSE_NLA_TRACK, TSE_DRIVER_BASE)) {
|
||||
/* pass */
|
||||
}
|
||||
else if (type == TSE_GP_LAYER) {
|
||||
|
@ -977,7 +977,13 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
|
|||
else if (type == TSE_ID_BASE) {
|
||||
/* pass */
|
||||
}
|
||||
else if (ELEM(type, TSE_KEYMAP, TSE_KEYMAP_ITEM)) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
/* Other cases must be caught above. */
|
||||
BLI_assert(TSE_IS_REAL_ID(tselem));
|
||||
|
||||
/* do here too, for blend file viewer, own ID_LI then shows file name */
|
||||
if (GS(id->name) == ID_LI) {
|
||||
te->name = ((Library *)id)->filepath;
|
||||
|
|
Loading…
Reference in New Issue