After setting a new text field's text shorter than the previous, the cursor stay in the same position. As a consequence, the cursor is out of the text's bound, and when a char is inserted/deleted, the text field tries to insert/delete a char out of the string, which cause a segmentation fault.
To fix it, it's needed to check if the cursor isn't out the string when setText(sf::String) is called, and if it's, then move the cursor to the new last char.
After setting a new text field's text shorter than the previous, the cursor stay in the same position. As a consequence, the cursor is out of the text's bound, and when a char is inserted/deleted, the text field tries to insert/delete a char out of the string, which cause a segmentation fault.
To fix it, it's needed to check if the cursor isn't out the string when setText(sf::String) is called, and if it's, then move the cursor to the new last char.