aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-03-09 14:08:28 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2015-03-09 14:08:28 +0000
commit2deb29c63fd28d651ce637dd596cf7009f6a5b8b (patch)
tree8d20ee8183d8eb60d2227f7d57dd4c26c581f8f3
parentf7798edaa90adfc7e2ff91063c932bdddfcce7cc (diff)
downloadqmmp-2deb29c63fd28d651ce637dd596cf7009f6a5b8b.tar.gz
qmmp-2deb29c63fd28d651ce637dd596cf7009f6a5b8b.tar.bz2
qmmp-2deb29c63fd28d651ce637dd596cf7009f6a5b8b.zip
fixed some column manager bugs
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4779 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/qmmpui/columnmanager.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/qmmpui/columnmanager.cpp b/src/qmmpui/columnmanager.cpp
index c9cdd3491..25d28b7c8 100644
--- a/src/qmmpui/columnmanager.cpp
+++ b/src/qmmpui/columnmanager.cpp
@@ -56,8 +56,11 @@ ColumnManager::~ColumnManager()
void ColumnManager::insert(int index, const QString &name, const QString &pattern)
{
- if(index < 0 || index >= m_columns.size())
+ if(index < 0 || index > m_columns.size())
+ {
qWarning("ColumnManager: index is out of range");
+ return;
+ }
Column col;
col.name = name;
@@ -72,7 +75,10 @@ void ColumnManager::insert(int index, const QString &name, const QString &patter
void ColumnManager::remove(int index)
{
if(index < 0 || index >= m_columns.size())
+ {
qWarning("ColumnManager: index is out of range");
+ return;
+ }
if(m_columns.count() == 1)
return;
@@ -85,7 +91,10 @@ void ColumnManager::remove(int index)
void ColumnManager::resize(int index, int size)
{
if(index < 0 || index >= m_columns.size())
+ {
qWarning("ColumnManager: index is out of range");
+ return;
+ }
m_columns[index].size = qMax(size, 30);
//sync();
@@ -95,10 +104,17 @@ void ColumnManager::resize(int index, int size)
void ColumnManager::move(int from, int to)
{
if(from < 0 || from >= m_columns.size())
+ {
qWarning("ColumnManager: index is out of range");
+ return;
+ }
if(to < 0 || to >= m_columns.size())
+ {
qWarning("ColumnManager: index is out of range");
+ return;
+ }
+
m_columns.move(from, to);
emit moved(from, to);
}