Handle out-of-range vertex IDs