diff --git a/apps/shared/function_store.cpp b/apps/shared/function_store.cpp index 377d535c0..f321582ce 100644 --- a/apps/shared/function_store.cpp +++ b/apps/shared/function_store.cpp @@ -9,23 +9,14 @@ FunctionStore::FunctionStore() : } Function * FunctionStore::activeFunctionAtIndex(int i) { - assert(i>=0 && iisActive() && function->isDefined()) { - if (i == index) { - return function; - } - index++; - } - } - assert(false); - return nullptr; + 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= 0 && i < numberOfActiveFunctions()); int index = 0; for (int k = 0; k < m_numberOfModels; k++) { Function * function = modelAtIndex(k);