I was calling the ntree syncing function too late. So the index of the layer was -1 since it was no longer in the ListBase, making all RenderLayer nodes to decrease their respective `custom1` (even going to negative sometimes).
I was calling the ntree syncing function too late. So the index of the layer was -1 since it was no longer in the ListBase, making all RenderLayer nodes to decrease their respective `custom1` (even going to negative sometimes).