Skip to content

Commit

Permalink
Avoid crash when trying to throw exceptions twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Bong Nguyen committed Nov 23, 2022
1 parent a767d0a commit d2a885b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ build
emsdk-portable
package-lock.json
.vscode
/bin/
9 changes: 6 additions & 3 deletions src/bindings/marker-index-wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,15 @@ optional<bool> MarkerIndexWrapper::bool_from_js(Napi::Value value) {

void MarkerIndexWrapper::insert(const CallbackInfo &info) {
optional<MarkerIndex::MarkerId> id = marker_id_from_js(info[0]);
if (!id) return;

optional<Point> start = PointWrapper::point_from_js(info[1]);
if (!start) return;

optional<Point> end = PointWrapper::point_from_js(info[2]);
if (!end) return;

if (id && start && end) {
this->marker_index->insert(*id, *start, *end);
}
this->marker_index->insert(*id, *start, *end);
}

void MarkerIndexWrapper::set_exclusive(const CallbackInfo &info) {
Expand Down
2 changes: 1 addition & 1 deletion test/js/text-buffer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1067,9 +1067,9 @@ describe('TextBuffer', () => {
const generateSeed = Random.create()
let seed = generateSeed(MAX_INT32)
const random = new Random(seed)
console.log('Seed: ', seed);

const testDocument = new TestDocument(seed)
console.log('Seed: ', seed);
const buffer = new TextBuffer(testDocument.getText())

for (let j = 0; j < 10; j++) {
Expand Down

0 comments on commit d2a885b

Please sign in to comment.