v.24.4Bug Fix

Fix crash in mergeTreeIndex function

Fix crash in function mergeTreeIndex #62762 (Anton Popov).