Skip to content

Conversation

@Hakerh400
Copy link
Contributor

Fix #1327

try_catch.ReThrow();
return;
}
Local<Object> font = maybeFont.ToLocalChecked();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast fix :).

A bit simpler: you can explicitly check if the MaybeLocal is empty with something like:

  MaybeLocal<Object> mlfont = Nan::To<Object>(parsed);
  if (mlfont.IsEmpty()) return;
  Local<Object> font = mlfont.ToLocalChecked();

The error will still be thrown appropriately when the handle is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Is there a need to test if mparsed is empty (can parseFont itself throw an error)?

Copy link
Collaborator

@zbjornson zbjornson Dec 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically I'm not sure if there's any v8 operation that returns a MaybeLocal that is guaranteed not to fail. (It seems it would return a Local instead.) I'm not sure how unwise it is to assume simple operations don't fail. Having it doesn't hurt.

@zbjornson zbjornson merged commit 8a49755 into Automattic:master Dec 13, 2018
@Hakerh400 Hakerh400 deleted the font branch December 13, 2018 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants