[native] Fix script errors if Material.getProperty returns null (#13665)

This commit is contained in:
James Chen
2022-12-06 10:15:57 +08:00
committed by GitHub
parent 61554d39e6
commit 6716fc8563
2 changed files with 7 additions and 6 deletions
+2 -5
View File
@@ -221,6 +221,8 @@ matProto.getProperty = function (name: string, passIdx?: number) {
}
return arr || val;
} else if (val === null || val === undefined) {
return null;
}
let ret;
@@ -266,11 +268,6 @@ materialProto._ctor = function () {
this._passes = [];
this._registerPassesUpdatedListener();
// _initializerDefineProperty(_this, "_effectAsset", _descriptor$d, _assertThisInitialized(_this));
// _initializerDefineProperty(_this, "_techIdx", _descriptor2$9, _assertThisInitialized(_this));
// _initializerDefineProperty(_this, "_defines", _descriptor3$7, _assertThisInitialized(_this));
// _initializerDefineProperty(_this, "_states", _descriptor4$6, _assertThisInitialized(_this));
// _initializerDefineProperty(_this, "_props", _descriptor5$4, _assertThisInitialized(_this));
this._isCtorCalled = true;
};
@@ -1075,7 +1075,11 @@ bool nativevalue_to_se(const ccstd::variant<ARGS...> *from, se::Value &to, se::O
template <typename... ARGS>
bool nativevalue_to_se(ccstd::variant<ARGS...> *from, se::Value &to, se::Object *ctx) { // NOLINT
return nativevalue_to_se(*from, to, ctx);
if (from != nullptr) {
return nativevalue_to_se(*from, to, ctx);
}
to.setNull();
return true;
}
template <typename T>