Skip to content

Commit

Permalink
Check if PyErr_Occurred if hiwire_get_value is passed a NULL JsRef (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hood Chatham authored Jan 11, 2021
1 parent 953a395 commit 381997a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/hiwire.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ EM_JS(int, hiwire_init, (), {
Module.hiwire.get_value = function(idval)
{
if (!idval) {
// This might have happened because the error indicator is set. Let's
// check.
if (_PyErr_Occurred()) {
// This will lead to a more helpful error message.
_pythonexc2js();
}
throw new Error("Argument to hiwire.get_value is undefined");
}
if (!_hiwire.objects.has(idval)) {
Expand Down

0 comments on commit 381997a

Please sign in to comment.