Skip to content

Commit f0cb6dd

Browse files
committed
qml: fix abort in ChainModel::setCurrentTimeRatio
1 parent 26d57ff commit f0cb6dd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/qml/chainmodel.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ void ChainModel::setCurrentTimeRatio()
7474
double current_time_ratio = double(secs_since_meridian) / SECS_IN_12_HOURS;
7575

7676
if (current_time_ratio < m_time_ratio_list[0].toDouble()) { // That means time has crossed a meridian
77-
m_time_ratio_list.erase(m_time_ratio_list.begin() + 2, m_time_ratio_list.end());
77+
m_time_ratio_list.clear();
7878
}
79-
m_time_ratio_list[0] = current_time_ratio;
79+
80+
if (m_time_ratio_list.isEmpty()) {
81+
m_time_ratio_list.push_back(current_time_ratio);
82+
m_time_ratio_list.push_back(0);
83+
} else {
84+
m_time_ratio_list[0] = current_time_ratio;
85+
}
86+
Q_EMIT timeRatioListChanged();
8087
}

0 commit comments

Comments
 (0)