Helper function to pop a single segment from an array of segments, and increment a referenced index variable.
The list of segments to pop from.
The referenced index to increment.
The segment that was popped, or null if we've reached the end of the segments list.
See Implementation
Helper function to pop a single segment from an array of segments, and increment a referenced index variable.