summaryrefslogtreecommitdiff
path: root/fxbarcode/oned/BC_OnedCode128Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/oned/BC_OnedCode128Writer.cpp')
-rw-r--r--fxbarcode/oned/BC_OnedCode128Writer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index 95a95b69e2..a6dc749a76 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -193,7 +193,9 @@ int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents,
int32_t patternIndex;
char ch = contents[position];
if (std::isdigit(ch)) {
- patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str());
+ patternIndex = FXSYS_atoi(
+ contents.Mid(position, position + 1 < contents.GetLength() ? 2 : 1)
+ .c_str());
++position;
if (position < contents.GetLength() && std::isdigit(contents[position]))
++position;