Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure model is not empty before removing rows. #2128

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Ensure model is not empty before removing rows.
Signed-off-by: Edward Kigwana <edwardwwgk@gmail.com>
  • Loading branch information
ekigwana committed May 26, 2019
commit e324e5a4d606a6e16b76083bebbe89970b42434f
8 changes: 5 additions & 3 deletions src/preferences/broadcastsettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ void BroadcastSettingsModel::resetFromSettings(BroadcastSettingsPointer pSetting
return;
}

beginRemoveRows(QModelIndex(), 0, m_profiles.size()-1);
endRemoveRows();
m_profiles.clear();
if (!m_profiles.isEmpty()) {
beginRemoveRows(QModelIndex(), 0, m_profiles.size()-1);
endRemoveRows();
m_profiles.clear();
}

for(BroadcastProfilePtr profile : pSettings->profiles()) {
BroadcastProfilePtr copy = profile->valuesCopy();
Expand Down
8 changes: 5 additions & 3 deletions src/preferences/effectsettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ void EffectSettingsModel::resetFromEffectManager(EffectsManager* pEffectsManager
return;
}

beginRemoveRows(QModelIndex(), 0, m_profiles.size()-1);
endRemoveRows();
m_profiles.clear();
if (!m_profiles.isEmpty()) {
beginRemoveRows(QModelIndex(), 0, m_profiles.size()-1);
endRemoveRows();
m_profiles.clear();
}

for (EffectManifestPointer pManifest : pEffectsManager->getAvailableEffectManifests()) {
const bool visibility = pEffectsManager->getEffectVisibility(pManifest);
Expand Down