[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [knights] src/rules: Fix crash when moving pawn two squares
From: Antonio Rojas <null () kde ! org>
Date: 2018-09-16 20:09:32
Message-ID: E1g1dMK-0002yu-HZ () code ! kde ! org
[Download RAW message or body]
Git commit 4d1d989114a054cc05d7015870865e69aba08ef8 by Antonio Rojas.
Committed on 16/09/2018 at 20:08.
Pushed by arojas into branch 'master'.
Fix crash when moving pawn two squares
Construct the QList before using it in the range based loop
BUG: 398722
Differential Revision: https://phabricator.kde.org/D15555
M +2 -1 src/rules/chessrules.cpp
https://commits.kde.org/knights/4d1d989114a054cc05d7015870865e69aba08ef8
diff --git a/src/rules/chessrules.cpp b/src/rules/chessrules.cpp
index 14f5350..efaf0b5 100644
--- a/src/rules/chessrules.cpp
+++ b/src/rules/chessrules.cpp
@@ -441,7 +441,8 @@ void ChessRules::moveMade ( const Move& m ) {
case Pawn:
if ( length ( m ) == 2 ) {
Pos mid = ( m.to() + m.from() ) / 2;
- for ( Direction dir : QList<Direction>() << W << E )
+ QList<Direction> dirs = QList<Direction>() << W << E;
+ for ( Direction dir : dirs )
if ( m_grid->contains ( m.to() + directions[dir] ) ) {
Move enPassantMove;
enPassantMove.setFrom ( m.to() + directions[dir] );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic