LGTM: [skip ci] fix: Empty branch of conditional

An empty block after a conditional can be a sign of an omission and can decrease maintainability of the code.
Such blocks should contain an explanatory comment to aid future maintainers.
This commit is contained in:
wmayer
2020-07-26 15:49:14 +02:00
parent 41380359a8
commit e9ce75d544
11 changed files with 36 additions and 18 deletions

View File

@@ -332,7 +332,7 @@ PyObject* DocumentPy::importLinks(PyObject *args)
return NULL; // NULL triggers exception
std::vector<App::DocumentObject*> objs;
if(PySequence_Check(obj)) {
if (PySequence_Check(obj)) {
Py::Sequence seq(obj);
for(size_t i=0;i<seq.size();++i) {
if(!PyObject_TypeCheck(seq[i].ptr(),&DocumentObjectPy::Type)) {
@@ -341,13 +341,18 @@ PyObject* DocumentPy::importLinks(PyObject *args)
}
objs.push_back(static_cast<DocumentObjectPy*>(seq[i].ptr())->getDocumentObjectPtr());
}
}else if(obj == Py_None) {
}else if(!PyObject_TypeCheck(obj,&DocumentObjectPy::Type)) {
}
else if(obj == Py_None) {
// do nothing here
}
else if(!PyObject_TypeCheck(obj,&DocumentObjectPy::Type)) {
PyErr_SetString(PyExc_TypeError,
"Expect first argument to be either a document object or sequence of document objects");
return 0;
}else
}
else {
objs.push_back(static_cast<DocumentObjectPy*>(obj)->getDocumentObjectPtr());
}
if(objs.empty())
objs = getDocumentPtr()->getObjects();