Skip to content

Commit 0e6963f

Browse files
committed
return null when not found row
1 parent 926f0b7 commit 0e6963f

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

src/gstype_python.i

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,23 +1811,27 @@ static bool getRowFields(GSRow* row, int columnCount, GSType* typeList, bool tim
18111811
}
18121812

18131813
%typemap(argout, fragment = "getRowFields") (GSRow *rowdata) {
1814-
GSRow* row = arg1->getGSRowPtr();
1815-
PyObject *outList = PyList_New(arg1->getColumnCount());
1816-
if (outList == NULL) {
1817-
PyErr_SetString(PyExc_ValueError, "Memory allocation for row is error");
1818-
SWIG_fail;
1819-
}
1820-
bool retVal;
1821-
int errorColumn;
1822-
GSType errorType;
1823-
retVal = getRowFields(row, arg1->getColumnCount(), arg1->getGSTypeList(), arg1->timestamp_output_with_float, &errorColumn, &errorType, outList);
1824-
if (retVal == false) {
1825-
char errorMsg[60];
1826-
sprintf(errorMsg, "Can't get data for field %d with type%d", errorColumn, errorType);
1827-
PyErr_SetString(PyExc_ValueError, errorMsg);
1828-
SWIG_fail;
1814+
if (result == GS_FALSE) {
1815+
Py_RETURN_NONE;
1816+
} else {
1817+
GSRow* row = arg1->getGSRowPtr();
1818+
PyObject *outList = PyList_New(arg1->getColumnCount());
1819+
if (outList == NULL) {
1820+
PyErr_SetString(PyExc_ValueError, "Memory allocation for row is error");
1821+
SWIG_fail;
1822+
}
1823+
bool retVal;
1824+
int errorColumn;
1825+
GSType errorType;
1826+
retVal = getRowFields(row, arg1->getColumnCount(), arg1->getGSTypeList(), arg1->timestamp_output_with_float, &errorColumn, &errorType, outList);
1827+
if (retVal == false) {
1828+
char errorMsg[60];
1829+
sprintf(errorMsg, "Can't get data for field %d with type%d", errorColumn, errorType);
1830+
PyErr_SetString(PyExc_ValueError, errorMsg);
1831+
SWIG_fail;
1832+
}
1833+
$result = outList;
18291834
}
1830-
$result = outList;
18311835
}
18321836

18331837
/**

0 commit comments

Comments
 (0)