Commit e8f757ed authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Check if model ptr is live to prevent crashing when triggering model updates...

Check if model ptr is live to prevent crashing when triggering model updates AND cleaning up existing models
parent ab0b5bd9
Pipeline #95837 passed with stage
in 5 minutes and 3 seconds
......@@ -32,11 +32,15 @@ InfiniteCalendarViewModel::InfiniteCalendarViewModel(QObject *parent)
for (auto &model : m_models) {
if (model.modelType != TypeWeek) {
for (const auto &startDate : std::as_const(model.affectedStartDates)) {
model.multiDayModels->value(startDate)->model()->updateQuery();
if (model.multiDayModels->value(startDate) != nullptr) {
model.multiDayModels->value(startDate)->model()->updateQuery();
}
}
} else {
for (const auto &startDate : std::as_const(model.affectedStartDates)) {
model.weekModels->value(startDate)->model()->updateQuery();
if (model.weekModels->value(startDate) != nullptr) {
model.weekModels->value(startDate)->model()->updateQuery();
}
}
}
}
......
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