"openmmapi/src/CustomAngleForce.cpp" did not exist on "64493da66474b3874c798d21d81b23fd5560134c"
Commit 2ad438b7 authored by Robert McGibbon's avatar Robert McGibbon
Browse files

Fix segfault when positions are not 3 dimensional.

parent 1c3d149d
......@@ -2,7 +2,7 @@
/* Convert python list of tuples to C++ std::vector of Vec3 objects */
%typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec) {
// typemap -- %typemap(in) std::vector<Vec3>& (std::vector<OpenMM::Vec3> vVec)
int i, pLength;
int i, pLength, itemLength;
double x, y, z;
PyObject *o;
PyObject *o1;
......@@ -10,6 +10,11 @@
pLength=(int)PySequence_Length($input);
for (i=0; i<pLength; i++) {
o=PySequence_GetItem($input, i);
itemLength = (int) PySequence_Length(o);
if (itemLength != 3) {
PyErr_SetString(PyExc_TypeError, "Item must have length 3");
return NULL;
}
o1=PySequence_GetItem(o, 0);
x=PyFloat_AsDouble(o1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment