summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2012-06-29 17:42:07 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2012-06-29 17:47:22 (GMT)
commit8969e8c3e11315fc75235a54c52c585b1c09053b (patch)
tree6699beee874bfd28696c2d11217a1f71ff7ad4fa
parent60e3adf447662da8e2bdc5993184909f19d8fd1e (diff)
Fix crash in setText.
BUG: 302747 (cherry picked from commit e494acab4a2217e169c5567383bd5240f6f503ed)
-rw-r--r--khtml/rendering/render_form.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/khtml/rendering/render_form.cpp b/khtml/rendering/render_form.cpp
index c00fdff..8c59a77 100644
--- a/khtml/rendering/render_form.cpp
+++ b/khtml/rendering/render_form.cpp
@@ -2363,8 +2363,9 @@ void RenderTextArea::setText(const QString& newText)
int cx = w->horizontalScrollBar()->value();
int cy = w->verticalScrollBar()->value();
// Not using setPlaintext as it resets text alignment property
+ int minLen = (newTextLen < oldTextLen) ? newTextLen : oldTextLen;
int ex = 0;
- while (ex < oldTextLen && newText[ex] == oldText[ex])
+ while (ex < minLen && (newText.at(ex) == oldText.at(ex)))
++ex;
QTextCursor tc = w->textCursor();
tc.setPosition(ex, QTextCursor::MoveAnchor);