From 3b90a68799c08ced4fcfaf84f8ffd1565cc0f6f7 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 19 Oct 2021 20:32:41 +0200 Subject: [PATCH] Berry prevent crash when setting static variable for solidified class --- lib/libesp32/Berry/src/be_class.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/libesp32/Berry/src/be_class.c b/lib/libesp32/Berry/src/be_class.c index 960612d1b..a6b94a1cf 100644 --- a/lib/libesp32/Berry/src/be_class.c +++ b/lib/libesp32/Berry/src/be_class.c @@ -346,10 +346,12 @@ bbool be_class_setmember(bvm *vm, bclass *o, bstring *name, bvalue *src) { bvalue v; be_assert(name != NULL); - bclass * obj = class_member(vm, o, name, &v); - if (obj && !var_istype(&v, MT_VARIABLE)) { - be_map_insertstr(vm, obj->members, name, src); - return btrue; + if (!gc_isconst(o)) { + bclass * obj = class_member(vm, o, name, &v); + if (obj && !var_istype(&v, MT_VARIABLE)) { + be_map_insertstr(vm, obj->members, name, src); + return btrue; + } } return bfalse; }