Fix undefined behavior in stalemate trap detection.
An important part of it is a function which detects if we can move a king or
pawn. If this function called before quiet move generation phase the end of the
checked move list is undefined (Thanks to AliceRoselia pointing out we have
some problem because of wrong bench in a test).
This problem exists also in master but is really rarely triggered (thanks to
vondele which found one) but it seen significant more often if the capture
order score is increased.
This fix now simply assumes in this case (and other similiar cases) that a king
or pawn can move without checking any moves.
Passed non-regression STC (with default book):
LLR: 3.03 (-2.94,2.94) <-1.75,0.25>
Total: 203008 W: 52465 L: 52424 D: 98119
Ptnml(0-2): 498, 20293, 59893, 20310, 510
https://tests.stockfishchess.org/tests/view/68a06ec5fd8719b088c8dc1a
Passed non-regression STC (with stalemates book):
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 31616 W: 14418 L: 14366 D: 2832
Ptnml(0-2): 1, 189, 15375, 243, 0
https://tests.stockfishchess.org/tests/view/68a07538fd8719b088c8dc1f
closes https://github.com/official-stockfish/Stockfish/pull/6235
Bench: 2996176