[gnome-chess] Fix promotion code



commit 17a7b87f8143df16973e99e2ba066742456eee73
Author: Sahil Sareen <sahil sareen hotmail com>
Date:   Sat Feb 21 12:23:59 2015 +0530

    Fix promotion code
    
    Add a check for 'file' before trying to move.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738947

 src/chess-scene.vala |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/chess-scene.vala b/src/chess-scene.vala
index 47b7312..0e0a96d 100644
--- a/src/chess-scene.vala
+++ b/src/chess-scene.vala
@@ -239,7 +239,9 @@ public class ChessScene : Object
                     selected_file, rank, file, true, promotion_selection);
                 selected_rank = selected_file = -1;
             }
-            if (game.current_player.move_with_coords (selected_rank, selected_file, rank, file))
+            // Need to check selected_file here again for promotion case
+            if (selected_file != -1 &&
+                game.current_player.move_with_coords (selected_rank, selected_file, rank, file))
                 selected_rank = selected_file = -1;            
         }
         


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]