[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kwordquiz/src
From:       Peter Hedlund <peter () peterandlinda ! com>
Date:       2009-08-31 22:11:05
Message-ID: 1251756665.254456.30403.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1017925 by hedlund:

Don't crash when pasting.

BUG: 205606

 M  +6 -5      kwqcommands.cpp  


--- trunk/KDE/kdeedu/kwordquiz/src/kwqcommands.cpp #1017924:1017925
@@ -167,15 +167,15 @@
     while (i < sl.count() && br <= view()->model()->rowCount(QModelIndex())) {
       ac = lc;
 
-      sr = sl.at(i).split('\t', QString::SkipEmptyParts);
+      sr = sl.at(i).split('\t');
       int c = 0;
       while (ac <= rc) {
         IndexAndData id;
         id.index = view()->model()->index(ar, ac);
         id.data = view()->model()->data(id.index, Qt::DisplayRole);
         m_pasteIndexAndData.append(id);
-
-        view()->model()->setData(id.index, QVariant(sr[c]), Qt::EditRole);
+        if (c < sr.count())
+            view()->model()->setData(id.index, QVariant(sr[c]), Qt::EditRole);
         view()->selectionModel()->select(id.index, QItemSelectionModel::Select);
         ac++;
         c++;
@@ -189,11 +189,12 @@
     while (i < sl.count() && ar <= br) {
       ac = lc;
 
-      sr = sl.at(i).split('\t', QString::SkipEmptyParts);
+      sr = sl.at(i).split('\t');
       int c = 0;
       while (ac <= rc) {
         if (view()->selectionModel()->isSelected(view()->model()->index(ar, ac)))
-          view()->model()->setData(view()->model()->index(ar, ac), QVariant(sr[c]), Qt::EditRole);
+            if (c < sr.count())
+                view()->model()->setData(view()->model()->index(ar, ac), QVariant(sr[c]), Qt::EditRole);
         ac++;
         c++;
       }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic