Skip to content

Commit 670fc75

Browse files
committed
Fix spine crash issue
1 parent 2ef1362 commit 670fc75

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

frameworks/js-bindings/bindings/manual/spine/jsb_cocos2dx_spine_manual.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jsval spbonedata_to_jsval(JSContext* cx, const spBoneData* v)
6969

7070
// root haven't parent
7171
JS::RootedValue parentVal(cx);
72-
if (strcmp(v->name, "root"))
72+
if (strcmp(v->name, "root") && v->parent)
7373
parentVal = spbonedata_to_jsval(cx, v->parent);
7474

7575
bool ok = JS_DefineProperty(cx, tmp, "name", JS::RootedValue(cx, c_string_to_jsval(cx, v->name)), JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
@@ -98,7 +98,7 @@ jsval spbone_to_jsval(JSContext* cx, spBone& v)
9898

9999
// root haven't parent
100100
JS::RootedValue parentVal(cx);
101-
if (strcmp(v.data->name, "root"))
101+
if (strcmp(v.data->name, "root") && v.parent)
102102
parentVal = spbone_to_jsval(cx, *v.parent);
103103

104104
bool ok = JS_DefineProperty(cx, tmp, "data", JS::RootedValue(cx, spbonedata_to_jsval(cx, v.data)), JSPROP_ENUMERATE | JSPROP_PERMANENT) &&

0 commit comments

Comments
 (0)