Skip to content

Commit

Permalink
fix using invalidated iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
bostick committed Oct 29, 2024
1 parent b59c7b6 commit a819331
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/tablature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,10 +1008,15 @@ TtbtFileTablature(const tbt_file_t &t) {
barLineWidth = 1;
}

//
// save this because barLinesMap may be modified later and invalidate barLinesMapIt
//
bool barLinesMapItIsEnd = (barLinesMapIt == barLinesMap.end());

//
// bar line (when processed BEFORE the space)
//
if (barLinesMapIt != barLinesMap.end()) {
if (!barLinesMapItIsEnd) {

if constexpr (0x70 <= VERSION) {

Expand Down Expand Up @@ -1356,7 +1361,7 @@ TtbtFileTablature(const tbt_file_t &t) {
//
// bar line (when processed AFTER the space)
//
if (barLinesMapIt != barLinesMap.end()) {
if (!barLinesMapItIsEnd) {

if constexpr (0x70 <= VERSION) {

Expand Down

0 comments on commit a819331

Please sign in to comment.