From ff52b9f0b0ca9dd27ab35aabb637631c447a3913 Mon Sep 17 00:00:00 2001 From: rhenninger Date: Mon, 15 Aug 2016 09:16:50 -0400 Subject: [PATCH] Need to cover zero token case (Shakers) Previous fix to#63 didn't cover case where there are no tokens left because skini messages provides all values. For example, changing a shaker instrument has no further tokens, but rather pulls two constants directly from skini_msgs[]. Changed test ca line161 to bail out when more tokens are expected and none are left: when data type is SK_INT, SK_DBL or SK_STR (all less than 0) --- src/Skini.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Skini.cpp b/src/Skini.cpp index 441ffe7..8c41a09 100644 --- a/src/Skini.cpp +++ b/src/Skini.cpp @@ -158,7 +158,8 @@ long Skini :: parseString( std::string& line, Message& message ) while ( dataType != NOPE ) { // if ( tokens.size() <= (unsigned int) (iValue+3) ) { //rgh: test iToken rather than always testing iValue+3 - if (tokens.size() <= iToken) { +// if (tokens.size() <= iToken) { //rgh: iToken only tests it more tokens are to be consumed (SK_INT, SK_DBL, SK_STR) + if ((tokens.size() <= iToken) && (dataType < 0)) { //Don't fail if remaining iValues come from skini_msgs[] rather than tokens[]. oStream_ << "Skini::parseString: inconsistency between type table and parsed line:\n " << line; handleError( StkError::WARNING ); return message.type = 0;