oh fuck, I think this is entirely my fault. I think there's two linked lists that are used separately by this function, but both are related to resources so I named them both basically "resource_linked_list" and didn't notice the function switches between which one it is using