Fix uncaught exceptions from Val cloning failures

This commit is contained in:
Jon Siwek 2019-07-11 16:55:39 -07:00
parent 418ab0e33a
commit e5e84041b7

View file

@ -1747,7 +1747,20 @@ Val* TableVal::Default(Val* index)
if ( def_val->Type()->Tag() != TYPE_FUNC || if ( def_val->Type()->Tag() != TYPE_FUNC ||
same_type(def_val->Type(), Type()->YieldType()) ) same_type(def_val->Type(), Type()->YieldType()) )
return def_attr->AttrExpr()->IsConst() ? def_val->Ref() : def_val->Clone(); {
if ( def_attr->AttrExpr()->IsConst() )
return def_val->Ref();
try
{
return def_val->Clone();
}
catch ( InterpreterException& e )
{ /* Already reported. */ }
Error("&default value for table is not clone-able");
return 0;
}
const Func* f = def_val->AsFunc(); const Func* f = def_val->AsFunc();
val_list vl; val_list vl;