Fix null prev() segment pointer after the use of swing