Skip to content

Commit

Permalink
code tidyup - don't rewrite msg with something that then needs unlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 15, 2023
1 parent 8611d05 commit 9a3d765
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/jswrap_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ JsVar *_jswrap_error_constructor(JsVar *msg, char *type) {
JsVar *d = jspNewObject(0,type);
if (!d) return 0;

if (msg) {
msg = jsvAsString(msg);
jsvObjectSetChildAndUnLock(d, "message", msg);
}
if (msg)
jsvObjectSetChildAndUnLock(d, "message", jsvAsString(msg));
jsvObjectSetChildAndUnLock(d, "type", jsvNewFromString(type));

return d;
Expand Down

0 comments on commit 9a3d765

Please sign in to comment.