Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit c4cc10f

Browse files
committed
Prevent callback from being called twice. Refs #28
1 parent a9c8a3d commit c4cc10f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export default function sqliteParser(source, options, callback) {
2222
if (isAsync) {
2323
// Async
2424
setTimeout(function () {
25-
let result;
25+
let result, err;
2626
try {
2727
result = parse(source, opts);
2828
} catch (e) {
29-
callback(e instanceof PegSyntaxError ? t.smartError(e) : e);
29+
err = e instanceof PegSyntaxError ? t.smartError(e) : e;
3030
}
31-
callback(null, result);
31+
callback(err, result);
3232
}, 0);
3333
} else {
3434
// Sync

0 commit comments

Comments
 (0)