the check in deleteSegment checks for numSegments > 1 and is later used to index this.segments. So this check effictively means that 0 and 1 are not allowed as index. However, index 1 should be allowed to remove the first segment.
So changing the check to numSegments > 0 or >= 1 would fix this big
the check in
deleteSegmentchecks fornumSegments > 1and is later used to indexthis.segments. So this check effictively means that0and1are not allowed as index. However, index 1 should be allowed to remove the first segment.So changing the check to
numSegments > 0or>= 1would fix this big