From 3d8a485fb9bef36f717423955c587ebc7834c784 Mon Sep 17 00:00:00 2001 From: Kester Maddock Date: Sat, 18 Sep 2004 06:03:15 +0000 Subject: Fixed PyObject_IsMT_Matrix --- source/gameengine/Ketsji/KX_PyMath.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/gameengine/Ketsji/KX_PyMath.cpp') diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp index 47984aa22ec..5e300c4dd71 100644 --- a/source/gameengine/Ketsji/KX_PyMath.cpp +++ b/source/gameengine/Ketsji/KX_PyMath.cpp @@ -60,20 +60,19 @@ bool PyObject_IsMT_Matrix(PyObject *pymat, unsigned int rank) if (rows != rank) return false; - for (y = 0; y < rank; y++) + bool ismatrix = true; + for (y = 0; y < rank && ismatrix; y++) { PyObject *pyrow = PySequence_GetItem(pymat, y); /* new ref */ if (PySequence_Check(pyrow)) { if (PySequence_Size(pyrow) != rank) - { - Py_DECREF(pyrow); - return false; - } - } + ismatrix = false; + } else + ismatrix = false; Py_DECREF(pyrow); } - return true; + return ismatrix; } return false; } -- cgit v1.2.3