Fix crash when marker was at clip start

parent d5cb03d4
Pipeline #3690 passed with stage
in 14 minutes and 27 seconds
......@@ -31,7 +31,7 @@ ClipSnapModel::ClipSnapModel() = default;
void ClipSnapModel::addPoint(int position)
{
m_snapPoints.insert(position);
if (position <= m_inPoint * m_speed || position >= m_outPoint * m_speed) {
if (position < m_inPoint * m_speed || position >= m_outPoint * m_speed) {
return;
}
if (auto ptr = m_registeredSnap.lock()) {
......@@ -42,7 +42,7 @@ void ClipSnapModel::addPoint(int position)
void ClipSnapModel::removePoint(int position)
{
m_snapPoints.erase(position);
if (position <= m_inPoint * m_speed || position >= m_outPoint * m_speed) {
if (position < m_inPoint * m_speed || position >= m_outPoint * m_speed) {
return;
}
if (auto ptr = m_registeredSnap.lock()) {
......@@ -73,7 +73,7 @@ void ClipSnapModel::addAllSnaps()
if (auto ptr = m_registeredSnap.lock()) {
for (const auto &snap : m_snapPoints) {
if (snap >= m_inPoint * m_speed && snap < m_outPoint * m_speed) {
ptr->addPoint(m_speed < 0 ? m_outPoint + m_position + snap / m_speed - m_inPoint : m_position + snap / m_speed- m_inPoint);
ptr->addPoint(m_speed < 0 ? m_outPoint + m_position + snap / m_speed - m_inPoint : m_position + snap / m_speed - m_inPoint);
}
}
}
......@@ -84,7 +84,7 @@ void ClipSnapModel::removeAllSnaps()
if (auto ptr = m_registeredSnap.lock()) {
for (const auto &snap : m_snapPoints) {
if (snap >= m_inPoint * m_speed && snap < m_outPoint * m_speed) {
ptr->removePoint(m_speed < 0 ? m_outPoint + m_position + snap / m_speed - m_inPoint : m_position + snap / m_speed- m_inPoint);
ptr->removePoint(m_speed < 0 ? m_outPoint + m_position + snap / m_speed - m_inPoint : m_position + snap / m_speed - m_inPoint);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment