If the trader updateTime is missing min/max use defaults (!307)

This is just another catch for people trying to run outdated trader mods, will use default refresh time instead of returning null for the trader update seconds.

Lets users know in the console right off the bat that there's a problem with the trader

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/307
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
DrakiaXYZ 2024-04-25 17:46:27 +00:00 committed by chomp
parent fbf1d7f7fb
commit ea38e50cca

View File

@ -272,7 +272,7 @@ export class TraderHelper
public getTraderUpdateSeconds(traderId: string): number public getTraderUpdateSeconds(traderId: string): number
{ {
const traderDetails = this.traderConfig.updateTime.find((x) => x.traderId === traderId); const traderDetails = this.traderConfig.updateTime.find((x) => x.traderId === traderId);
if (!traderDetails) if (!traderDetails || traderDetails.seconds.min === undefined || traderDetails.seconds.max === undefined)
{ {
this.logger.warning( this.logger.warning(
this.localisationService.getText("trader-missing_trader_details_using_default_refresh_time", { this.localisationService.getText("trader-missing_trader_details_using_default_refresh_time", {