Mercurial > hg > vampy-host
diff native/PyRealTime.cpp @ 113:1c7c4bd74363
Fix RealTime compare (& thus the tests, for Py2 anyway)
author | Chris Cannam |
---|---|
date | Wed, 17 Jun 2015 12:43:01 +0100 |
parents | 9343eee50605 |
children | 3489986a044c 2370b942cd32 |
line wrap: on
line diff
--- a/native/PyRealTime.cpp Wed Jun 17 12:35:41 2015 +0100 +++ b/native/PyRealTime.cpp Wed Jun 17 12:43:01 2015 +0100 @@ -234,8 +234,12 @@ return Py_False; } - RealTime *a = PyRealTime_AS_REALTIME(self); - RealTime *b = PyRealTime_AS_REALTIME(other); + RealTime *ap = PyRealTime_AS_REALTIME(self); + RealTime *bp = PyRealTime_AS_REALTIME(other); + + if (!ap || !bp) return Py_False; + const RealTime &a = *ap; + const RealTime &b = *bp; if (op == Py_LT) { return (a < b) ? Py_True : Py_False; @@ -395,7 +399,8 @@ if (!PyRealTime_Check(s)) { PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); cerr << "in call PyRealTime_AsPointer(): RealTime Object Expected. " << endl; - return NULL; } + return NULL; + } return s->rt; };