[FIX] Error on leaves list index out of range

Merged Facundo Barral requested to merge T-7577 into main

Merge request reports