[gcompris] Fix crash with params x/y of wrong datatype.

commit a0f2e6a507259718e20028d1595cddd69f24a9dd
Author: Peter Albrecht <pa-dev gmx de>
Date:   Thu Aug 2 19:58:01 2012 +0200

    Fix crash with params x/y of wrong datatype.
    The functionparameters x and y are sometimes float instead of int.
    This leads to a crash at "xrange(y)" in the code below. This happens
    for example with GIMP v2.6.12 and python v2.7.3 on a gentoo linux
    system. Since x and y are always integer values - the spinners
    configuration won't allow other values - we can safely convert to int

 tools/gcompris_shapegame.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tools/gcompris_shapegame.py b/tools/gcompris_shapegame.py
index 7a980f1..f8f99ba 100755
--- a/tools/gcompris_shapegame.py
+++ b/tools/gcompris_shapegame.py
@@ -109,6 +109,10 @@ def gcompris_puzzle(img, sdrawable, x, y, activity_name,
     if(not activity_name):
         activity_name = "paintings"
+    # make float to int
+    x = int(x)
+    y = int(y)
     # Init
     bg_layer = img.active_layer

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