# HG changeset patch # User Chris Cannam # Date 1434022251 -3600 # Node ID edd9c1c769a0583f7f5828358d82bfc5c4cc2a76 # Parent f5fdc397975a17695a3d3dac27a537a15ad835ea Fix crash in looking up expand direction, when the entire reference audio has been fed before any performance has (a pathological case) diff -r f5fdc397975a -r edd9c1c769a0 src/Finder.cpp --- a/src/Finder.cpp Thu Apr 23 13:47:48 2015 +0100 +++ b/src/Finder.cpp Thu Jun 11 12:30:51 2015 +0100 @@ -14,6 +14,9 @@ COPYING included with this distribution for more information. */ +//#define DEBUG_FINDER 1 +//#define PERFORM_ERROR_CHECKS 1 + #include "Finder.h" #include "Path.h" @@ -23,9 +26,6 @@ using namespace std; -//#define DEBUG_FINDER 1 -//#define PERFORM_ERROR_CHECKS 1 - Finder::Finder(Matcher *pm) { m_m = pm; diff -r f5fdc397975a -r edd9c1c769a0 src/Matcher.cpp --- a/src/Matcher.cpp Thu Apr 23 13:47:48 2015 +0100 +++ b/src/Matcher.cpp Thu Jun 11 12:30:51 2015 +0100 @@ -24,6 +24,7 @@ using namespace std; //#define DEBUG_MATCHER 1 +//#define PERFORM_ERROR_CHECKS 1 Matcher::Matcher(Parameters parameters, DistanceMetric::Parameters dparams, Matcher *p) : @@ -350,15 +351,23 @@ } else if (m_frameCount == 0) { // first row - updateValue(0, index, AdvanceOther, - getPathCost(0, index-1), - distance); + pathcost_t cost {}; + + if (isInRange(0, index - 1)) { + cost = getPathCost(0, index - 1); + } + + updateValue(0, index, AdvanceOther, cost, distance); } else if (index == 0) { // first column - updateValue(m_frameCount, index, AdvanceThis, - getPathCost(m_frameCount - 1, 0), - distance); + pathcost_t cost {}; + + if (isInRange(m_frameCount - 1, 0)) { + cost = getPathCost(m_frameCount - 1, 0); + } + + updateValue(m_frameCount, index, AdvanceThis, cost, distance); } else if (index == m_otherMatcher->m_frameCount - m_blockSize) {