I've read the topic a while ago, and experimented on my own, and came with this solution for myself:
(if (and (vl-catch-all-error-p (vl-catch-all-apply '(lambda (x) (vlax-invoke x 'getleaderlineindexes 1)) (list acadObj)))
(= (vl-catch-all-error-message (vl-catch-all-apply '(lambda (x) (vlax-invoke x 'getleaderlineindexes 1)) (list acadObj)))
"AutoCAD.Application: Invalid index"))
(setq sde_ml_indxlist (vlax-invoke acadObj 'getleaderlineindexes 0))
(if (and (vl-catch-all-error-p (vl-catch-all-apply '(lambda (x) (vlax-invoke x 'getleaderlineindexes 0)) (list acadObj)))
(= (vl-catch-all-error-message (vl-catch-all-apply '(lambda (x) (vlax-invoke x 'getleaderlineindexes 0)) (list acadObj)))
"AutoCAD.Application: Invalid index"))
(setq sde_ml_indxlist (vlax-invoke acadObj 'getleaderlineindexes 1))
(setq sde_ml_indxlist (vl-sort (append (vlax-invoke acadObj 'getleaderlineindexes 0)
(vlax-invoke acadObj 'getleaderlineindexes 1)) '<))))
This way I can retrieve lineindexes that answer to
either ”0”,
or ”1”,
or both at the same time (when mleader has leaders in both directions).
1st I check if mleader fails to deliver "1"-leaderlineindexes. If it fails, it means it can only deliver "0"-leaderlineindexes. It retrieves "0"-leaderlineindexes.
Than I check vice-versa.
If both these fail-verifications fail, this means that both deliveries "0" and "1" leaderlineindexes is possible.
So, as 3rd option, my routine retrieves all "0" and "1" leaderlineindexes.
It also sort's them in ascending order.
The only thing my routine doesn't handle properly, is the case when mleader doesn't have leaders at all... But well, I don't run my routing on such mleaders