Skip to content

Commit

Permalink
fixing a crash when the chromosome name only has one word
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesena1 committed Jul 3, 2021
1 parent 9a070f4 commit 17d21f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion smithlab_os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ read_fasta_file_short_names(const string &filename,
string line;
while (getline(in, line)) {
if (line[0] == '>') {
names.push_back(string(begin(line) + 1,
const auto first_space = line.find_first_of(" \t", 1);
if (first_space == string::npos)
names.push_back(line.substr(1));
else
names.push_back(string(begin(line) + 1,
begin(line) + line.find_first_of(" \t", 1)));
sequences.push_back(string());
}
Expand Down

0 comments on commit 17d21f3

Please sign in to comment.