Skip to content

Commit 327116d

Browse files
authored
Merge pull request #372 from avinxshKD/fix/parser-empty-string-crash
fix: guard against empty string crash in parser() and bounds check in…
2 parents 5b9554f + 82cea61 commit 327116d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

concore.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ class Concore{
279279
*/
280280
vector<double> parser(string f){
281281
vector<double> temp;
282+
if(f.empty()) return temp;
282283
string value = "";
283284

284285
//Changing last bracket to comma to use comma as a delimiter
@@ -370,6 +371,10 @@ class Concore{
370371
s += ins;
371372

372373
vector<double> inval = parser(ins);
374+
if(inval.empty())
375+
inval = parser(initstr);
376+
if(inval.empty())
377+
return inval;
373378
simtime = simtime > inval[0] ? simtime : inval[0];
374379

375380
//returning a string with data excluding simtime
@@ -432,6 +437,10 @@ class Concore{
432437
s += ins;
433438

434439
vector<double> inval = parser(ins);
440+
if(inval.empty())
441+
inval = parser(initstr);
442+
if(inval.empty())
443+
return inval;
435444
simtime = simtime > inval[0] ? simtime : inval[0];
436445

437446
//returning a string with data excluding simtime

0 commit comments

Comments
 (0)