Skip to content

Commit

Permalink
Handle string result from extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Jan 24, 2021
1 parent 73007c2 commit 835ab0c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions unpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,16 @@ exports.setExtractor = (extractStrings) => {
return function readString(length) {
let string = strings[stringPosition++]
if (string == null) {
strings = extractStrings(position - headerLength, srcEnd, src)
stringPosition = 0
srcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
string = strings[stringPosition++]
let extraction = extractStrings(position - headerLength, srcEnd, src)
if (typeof extraction == 'string') {
string = extraction
strings = EMPTY_ARRAY
} else {
strings = extraction
stringPosition = 0
srcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings
string = strings[stringPosition++]
}
}
let srcStringLength = string.length
if (srcStringLength <= length) {
Expand Down

0 comments on commit 835ab0c

Please sign in to comment.