summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 1fc32946fc..74a5e3adfc 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -430,18 +430,16 @@ void CPDF_VariableText::SetText(const CFX_WideString& swText) {
switch (word) {
case 0x0D:
if (m_bMultiLine) {
- if (swText.GetAt(i + 1) == 0x0A)
- i += 1;
-
+ if (i + 1 < sz && swText.GetAt(i + 1) == 0x0A)
+ i++;
wp.AdvanceSection();
AddSection(wp, secinfo);
}
break;
case 0x0A:
if (m_bMultiLine) {
- if (swText.GetAt(i + 1) == 0x0D)
- i += 1;
-
+ if (i + 1 < sz && swText.GetAt(i + 1) == 0x0D)
+ i++;
wp.AdvanceSection();
AddSection(wp, secinfo);
}