V3.6.2 format return null error fix (#12973)

This commit is contained in:
zxx43
2022-10-08 10:56:58 +08:00
committed by GitHub
parent 57811da71a
commit 28dcb4ab40
@@ -1472,15 +1472,19 @@ bool nativevalue_to_se(const cc::gfx::Rect &from, se::Value &to, se::Object * /*
// NOLINTNEXTLINE(readability-identifier-naming)
bool nativevalue_to_se(const cc::gfx::FormatInfo *from, se::Value &to, se::Object * /*unused*/) {
se::HandleObject obj(se::Object::createPlainObject());
obj->setProperty("name", se::Value(from->name));
obj->setProperty("size", se::Value(from->size));
obj->setProperty("count", se::Value(from->count));
obj->setProperty("type", se::Value(static_cast<int>(from->type)));
obj->setProperty("hasAlpha", se::Value(from->hasAlpha));
obj->setProperty("hasDepth", se::Value(from->hasDepth));
obj->setProperty("hasStencil", se::Value(from->hasStencil));
obj->setProperty("isCompressed", se::Value(from->isCompressed));
to.setObject(obj);
if (from) {
obj->setProperty("name", se::Value(from->name));
obj->setProperty("size", se::Value(from->size));
obj->setProperty("count", se::Value(from->count));
obj->setProperty("type", se::Value(static_cast<int>(from->type)));
obj->setProperty("hasAlpha", se::Value(from->hasAlpha));
obj->setProperty("hasDepth", se::Value(from->hasDepth));
obj->setProperty("hasStencil", se::Value(from->hasStencil));
obj->setProperty("isCompressed", se::Value(from->isCompressed));
to.setObject(obj);
} else {
to.setNull();
}
return true;
}