aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/studiowelcome/stylemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/studiowelcome/stylemodel.cpp')
-rw-r--r--src/plugins/studiowelcome/stylemodel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/studiowelcome/stylemodel.cpp b/src/plugins/studiowelcome/stylemodel.cpp
index d93fc5fded..1d548c510d 100644
--- a/src/plugins/studiowelcome/stylemodel.cpp
+++ b/src/plugins/studiowelcome/stylemodel.cpp
@@ -63,6 +63,12 @@ int StyleModel::filteredIndex(int actualIndex)
if (actualIndex < 0)
return actualIndex;
+ if (actualIndex >= m_items.size()) {
+ qWarning() << "Invalid actual index: " << actualIndex << "; Maximum index number permitted: "
+ << m_items.size() - 1;
+ return -1;
+ }
+
QStandardItem *item = m_items.at(actualIndex);
// TODO: perhaps should add this kind of find to utils/algorithm.h
auto it = std::find(std::cbegin(m_filteredItems), std::cend(m_filteredItems), item);