Skip to content

Commit 86bef73

Browse files
committed
cleanup
1 parent e8ca99d commit 86bef73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/io/snabble/sdk/encodedcodes/EncodedCodesGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,13 @@ private void addScannableCode(String scannableCode, boolean isAgeRestricted) {
128128

129129
int charsLeft = options.maxChars - stringBuilder.length();
130130
int suffixCodeLength = Math.max(nextCode.length(), options.finalCode.length());
131+
int codesNeeded = (suffixCodeLength > 0 ? 2 : 1);
131132
int requiredLength = scannableCode.length()
132133
+ suffixCodeLength
133-
+ options.separator.length() * (suffixCodeLength > 0 ? 2 : 1)
134+
+ options.separator.length() * codesNeeded
134135
+ options.suffix.length();
135136

136-
if (charsLeft < requiredLength || (codeCount + (suffixCodeLength > 0 ? 2 : 1)) > options.maxCodes) {
137+
if (charsLeft < requiredLength || (codeCount + codesNeeded) > options.maxCodes) {
137138
append(nextCode);
138139
finishCode();
139140
}

0 commit comments

Comments
 (0)