fix crash in event queue, while wrapping around. It was attempting to read an event while rptr==endptr.