mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-22 06:58:24 +00:00
为Character获取增加容错
This commit is contained in:
parent
f70415f4fe
commit
12bd03330a
@ -117,6 +117,9 @@ let getMeta = function (name) {
|
|||||||
|
|
||||||
Character.get = function (val) {
|
Character.get = function (val) {
|
||||||
let roleid, name;
|
let roleid, name;
|
||||||
|
if (!val) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (typeof (val) === "number" || /^\d*$/.test(val)) {
|
if (typeof (val) === "number" || /^\d*$/.test(val)) {
|
||||||
roleid = val;
|
roleid = val;
|
||||||
} else if (val.id) {
|
} else if (val.id) {
|
||||||
@ -131,8 +134,6 @@ Character.get = function (val) {
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new Character(name, roleid);
|
return new Character(name, roleid);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user