Skip to content

Commit bbd61bf

Browse files
committed
perfs: toASM throw error when receive invalid chunks
1 parent ac6a5b2 commit bbd61bf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ function toASM(chunks) {
158158
if (chunksIsBuffer(chunks)) {
159159
chunks = decompile(chunks);
160160
}
161+
if (!chunks) {
162+
throw new Error('convert invalid chunks to ASM');
163+
}
161164
return chunks
162165
.map(chunk => {
163166
// data?

ts_src/script.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ export function toASM(chunks: Buffer | Array<number | Buffer>): string {
168168
if (chunksIsBuffer(chunks)) {
169169
chunks = decompile(chunks) as Stack;
170170
}
171-
171+
if (!chunks) {
172+
throw new Error('convert invalid chunks to ASM');
173+
}
172174
return chunks
173175
.map(chunk => {
174176
// data?

0 commit comments

Comments
 (0)