Nullguard against missing data from client
This commit is contained in:
parent
7e75f867a0
commit
dd26a94ede
@ -141,6 +141,11 @@ export class InRaidHelper
|
|||||||
|
|
||||||
for (const backendCounterKey in saveProgressRequest.profile.BackendCounters)
|
for (const backendCounterKey in saveProgressRequest.profile.BackendCounters)
|
||||||
{
|
{
|
||||||
|
if (!saveProgressRequest.profile.BackendCounters[backendCounterKey].id)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const matchingPreRaidCounter = profileData.BackendCounters[backendCounterKey];
|
const matchingPreRaidCounter = profileData.BackendCounters[backendCounterKey];
|
||||||
if (!matchingPreRaidCounter)
|
if (!matchingPreRaidCounter)
|
||||||
{
|
{
|
||||||
@ -148,6 +153,7 @@ export class InRaidHelper
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchingPreRaidCounter.value !== saveProgressRequest.profile.BackendCounters[backendCounterKey].value)
|
if (matchingPreRaidCounter.value !== saveProgressRequest.profile.BackendCounters[backendCounterKey].value)
|
||||||
{
|
{
|
||||||
this.logger.error(`Backendcounter: ${backendCounterKey} value is different post raid, old: ${matchingPreRaidCounter.value} new: saveProgressRequest.profile.BackendCounters[backendCounterKey].value`);
|
this.logger.error(`Backendcounter: ${backendCounterKey} value is different post raid, old: ${matchingPreRaidCounter.value} new: saveProgressRequest.profile.BackendCounters[backendCounterKey].value`);
|
||||||
|
@ -244,7 +244,7 @@ export class InsuranceService
|
|||||||
{
|
{
|
||||||
equipmentToSendToPlayer.push({
|
equipmentToSendToPlayer.push({
|
||||||
pmcData: pmcData,
|
pmcData: pmcData,
|
||||||
itemToReturnToPlayer: this.getInsuredItemDetails(pmcData, preRaidItem, offraidData.insurance.find(x => x.id === insuredItem.itemId)),
|
itemToReturnToPlayer: this.getInsuredItemDetails(pmcData, preRaidItem, offraidData.insurance?.find(x => x.id === insuredItem.itemId)),
|
||||||
traderId: insuredItem.tid,
|
traderId: insuredItem.tid,
|
||||||
sessionID: sessionID
|
sessionID: sessionID
|
||||||
});
|
});
|
||||||
@ -293,7 +293,7 @@ export class InsuranceService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Client item has durability values, Ensure values persist into server data
|
// Client item has durability values, Ensure values persist into server data
|
||||||
if (insuredItemFromClient.durability)
|
if (insuredItemFromClient?.durability)
|
||||||
{
|
{
|
||||||
// Item didnt have Repairable object pre-raid, add it
|
// Item didnt have Repairable object pre-raid, add it
|
||||||
if (!itemToReturn.upd.Repairable)
|
if (!itemToReturn.upd.Repairable)
|
||||||
|
Loading…
Reference in New Issue
Block a user