Skip to content

Commit

Permalink
BUG: crash when trying to load relocated-phase.csv file
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-s committed Jun 5, 2020
1 parent a8bbc2f commit e5bf056
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/scrtdd/hdd/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ void Catalog::writeToFile(string eventFile, string phaseFile, string stationFile

if ( ! ev.relocInfo.isRelocated )
{
evStreamReloc << ",false,,,,,,,,,,";
evStreamReloc << ",false,,,,,,,,,";
}
else
{
Expand Down Expand Up @@ -817,7 +817,7 @@ void Catalog::writeToFile(string eventFile, string phaseFile, string stationFile
{
if ( ! ph.relocInfo.isRelocated )
{
phStream << ",false,,,";
phStream << ",false,,,,,,,";
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion apps/scrtdd/hdd/csvreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ vector< unordered_map<string,string> > format(const vector<string>& header,
unordered_map<string,string> row;
for (size_t i = 0; i < header.size(); ++i)
{
row[ header[i] ] = columns[i];
row[ header[i] ] = i < columns.size() ? columns[i] : "";
}
rows.push_back(row);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/scrtdd/hdd/csvreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace CSV {
* Optionally a header, the first line, can be present. If not present you
* can pass the header format to the function.
* Each line has to have the same number of fields of the header, additional
* columns will be disregarded
* If a line has more fields than the header,those will be discarded
* If a line has less fields than the header,the missing ones will be set to empty string
header1,header2,header3,header4
val1,val2,val3,val4
Expand Down

0 comments on commit e5bf056

Please sign in to comment.