ranges: add a sanity check in str_to_rl_helper()