Created attachment 130151 [details] Ensure space after "Talon:" entry SUMMARY Using Black Hole Solver, sometimes when dealing the last card from the deck the game will crash. This happens when BH solver is called on the last card (i.e. when the game is not lost). It can also be triggered by doing an Undo and replaying the last card from the deck. STEPS TO REPRODUCE 1. Start a game of Golf 2. Deal all cards from the deck 3. Undo the last move (one card back to the deck) 4. Deal last card from the deck OBSERVED RESULT The application crashes with message "Error reading the board at line No. 2!". EXPECTED RESULT Same behavior as in step #2 -- no crash, solver reporting "This game is lost". SOFTWARE/OS VERSIONS KDE Plasma Version: 5.19.3 KDE Frameworks Version: 5.72.0 Qt Version: 5.15.0 ADDITIONAL INFORMATION This error is returned from Black Hole Solver because of missing space in board description. When there are no cards in the deck, Golf will produce a line "Talon:", but BH Solver expects there to always be a space after the colon, like in "Talon: ". I have attached a patch that should solve the issue. Also, about being able to reproduce it with the Undo button: this could be related to bug 424261. When reaching "This game is lost" state while there are still cards in the deck, BH Solver will no longer be called, so we will not encounter the missing space issue. However after doing an Undo and replaying the last move BH Solver is called again, leading to the crash.
Thank you for reporting this issue in KDE software. As it was reported on an older version, can we please ask you to see if you can reproduce the issue with a more recent software version? If you can confirm this issue still exists in a recent version, please change the version field and the status to "REPORTED" when replying. Thank you!
Sure, I can still reproduce the issue in exactly the same way on both 22.08.3 and 22.11.90.
A possibly relevant merge request was started @ https://invent.kde.org/games/kpat/-/merge_requests/32
Git commit c4bb5993cb34a80867a5ddfdfa8aabad249f63f2 by Albert Astals Cid, on behalf of Maciej Stanczew. Committed on 02/12/2022 at 22:28. Pushed by aacid into branch 'release/22.12'. Fix crash when dealing last card from the deck M +4 -2 src/golf.cpp https://invent.kde.org/games/kpat/commit/c4bb5993cb34a80867a5ddfdfa8aabad249f63f2
*** Bug 465032 has been marked as a duplicate of this bug. ***