Berry prevent crash when setting static variable for solidified class

This commit is contained in:
Stephan Hadinger 2021-10-19 20:32:41 +02:00
parent 53457058f7
commit 3b90a68799
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}