The issue is that `ANIM_animdata_filter` with the flag `ANIMFILTER_ANIMDATA` did not actually return only animdata. The reason for this is in `animdata_filter_grease_pencil_data`, where there is special handling for this flag. It seems that returning non-animdata things is expected for Grease Pencil. So my solution is to just verify the type of `bAnimListElem` before use. Pull Request: https://projects.blender.org/blender/blender/pulls/133853