Skip to content

Commit e76bd2e

Browse files
committed
Fix segfault if .clone is called with this==undefined
1 parent 31e0fec commit e76bd2e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
ESP32: update EspruinoBuildTools to esp-idf V3.1.3
2727
nRF52: Add FAT Filesystem support to MDBT42Q module
2828
Now save file modification time with FAT
29+
Fix segfault if `.clone` is called with `this==undefined`
2930

3031
2v01 : ESP32: update to esp-idf V3.1
3132
Fix issues with Class Extends

src/jswrap_object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ JsVar *jswrap_object_toString(JsVar *parent, JsVar *arg0) {
142142
Copy this object completely
143143
*/
144144
JsVar *jswrap_object_clone(JsVar *parent) {
145+
if (!parent) return 0;
145146
return jsvCopy(parent, true);
146147
}
147148

0 commit comments

Comments
 (0)