[graph] Fix bug when initializing the selected function on graph

This commit is contained in:
Émilie Feral
2018-07-06 13:30:13 +02:00
committed by EmilieNumworks
parent 34198945f2
commit d36c0c8746
3 changed files with 4 additions and 12 deletions

View File

@@ -9,26 +9,19 @@ FunctionStore::FunctionStore() :
}
Function * FunctionStore::activeFunctionAtIndex(int i) {
assert(i >= 0 && i < numberOfActiveFunctions());
Function * function = modelAtIndex(activeFunctionStoreIndex(i));
assert(function->isActive() && function->isDefined());
return function;
}
int FunctionStore::activeFunctionStoreIndex(int i) {
assert(i >= 0 && i < numberOfActiveFunctions());
int index = 0;
for (int k = 0; k < m_numberOfModels; k++) {
Function * function = modelAtIndex(k);
if (function->isActive() && function->isDefined()) {
if (i == index) {
return k;
return function;
}
index++;
}
}
assert(false);
return -1;
return nullptr;
}
int FunctionStore::numberOfActiveFunctions() {