mirror of
https://github.com/motajs/template.git
synced 2026-10-05 03:00:16 +08:00
fix: equipStore 的 nextUid 在空存档下报错
This commit is contained in:
parent
b6d1976fc7
commit
ba60ef99eb
@ -297,11 +297,15 @@ export class HeroEquipsStore<THero> implements IHeroEquipsStore<THero> {
|
||||
this.instanceMap.delete(uid);
|
||||
}
|
||||
}
|
||||
const maxUid = maxBy(state.equipments, 'uid');
|
||||
if (!maxUid) {
|
||||
logger.error(58);
|
||||
return;
|
||||
if (state.equipments.length === 0) {
|
||||
this.nextUid = 0;
|
||||
} else {
|
||||
const maxUid = maxBy(state.equipments, 'uid');
|
||||
if (!maxUid) {
|
||||
logger.error(58);
|
||||
return;
|
||||
}
|
||||
this.nextUid = maxUid.uid + 1;
|
||||
}
|
||||
this.nextUid = maxUid.uid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user