diff --git a/project/src/controllers/BuildController.ts b/project/src/controllers/BuildController.ts index d378bd27..25e9e24c 100644 --- a/project/src/controllers/BuildController.ts +++ b/project/src/controllers/BuildController.ts @@ -193,6 +193,9 @@ export class BuildController this.logger.error(`Unable to delete preset, cannot find ${id} in weapon, equipment or magazine presets`); } + /** + * Handle client/builds/magazine/save + */ public createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void { const result: IMagazineBuild = { @@ -206,6 +209,11 @@ export class BuildController const profile = this.profileHelper.getFullProfile(sessionId); + if (!profile.userbuilds.magazineBuilds) + { + profile.userbuilds.magazineBuilds = []; + } + const existingArrayId = profile.userbuilds.magazineBuilds.findIndex(item => item.Name === request.Name); if (existingArrayId === -1)