daylen / stockfish-mac

Beautiful, powerful chess app for the Mac
http://stockfishchess.org/mac/
GNU General Public License v3.0
511 stars 116 forks source link

Crash when FEN string contains whitespace #17

Closed ghost closed 9 years ago

ghost commented 9 years ago

Steps:

  1. Open Stockfish app
  2. Paste
r2r4/ppqnb1kp/2p1bpp1/2P1p3/1P2P3/P1N1BP2/1Q2B1PP/1RR4K w - - 1 20

(with trailing whitespaces and newline character)

  1. Start Infinite Analysis

Just to recap, in previous issue, the app also crashed when fen started with whitespace character.

Please fix the fen issues as copy-pasting from external sources, it is very common that sometimes unnecessary whitespace/newline characters sneak through.

scchess commented 9 years ago

Daylen, please do a trim() on an FEN string. Furthermore, the program should not crash in any case. It should do a validation wrapped in a try-catch block. Only proceed to the engine if the validation succeeds.

daylen commented 9 years ago

Whitespace and newlines are now trimmed with commit https://github.com/daylen/stockfish-mac/commit/f46923988c9adccbba9cfe2e10579363ad3cd8af