diff options
author | Carl Hetherington <carl@carlh.net> | 2010-06-07 12:44:15 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-06-07 12:44:15 +0000 |
commit | e6becb342553ee3197a2f4cf3e23f1118d91383b (patch) | |
tree | ac6957fc3046bb838d7d0109093451a883c3f08f /libs/ardour | |
parent | 9510cb20fcb9376fa20fc7bbc35aa8c53c55137e (diff) |
Better-define behaviour when relayering a playlist with a single zero-length region. Fixes #3144.
git-svn-id: svn://localhost/ardour2/branches/3.0@7238 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/playlist.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 2044a2f142..bab4e358f9 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -2432,14 +2432,22 @@ Playlist::relayer () /* reset the pending explicit relayer flag for every region, now that we're relayering */ (*i)->set_pending_explicit_relayer (false); - /* find the time divisions that this region covers */ - int const start_division = floor ( ((*i)->position() - start) / division_size); - int end_division = floor ( ((*i)->position() + (*i)->length() - start) / division_size ); - if (end_division == divisions) { - end_division--; + /* find the time divisions that this region covers; if there are no regions on the list, + division_size will equal 0 and in this case we'll just say that + start_division = end_division = 0. + */ + int start_division = 0; + int end_division = 0; + + if (division_size > 0) { + start_division = floor ( ((*i)->position() - start) / division_size); + end_division = floor ( ((*i)->position() + (*i)->length() - start) / division_size ); + if (end_division == divisions) { + end_division--; + } } - assert (end_division < divisions); + assert (divisions == 0 || end_division < divisions); /* find the lowest layer that this region can go on */ size_t j = layers.size(); |