mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
make itemHasBaseClass()
more robust against bad input
This commit is contained in:
parent
8e377594da
commit
292791aca4
@ -1,6 +1,7 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
|
||||
import { BaseClasses } from "../models/enums/BaseClasses";
|
||||
import { ILogger } from "../models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||
import { LocalisationService } from "./LocalisationService";
|
||||
@ -83,6 +84,19 @@ export class ItemBaseClassService
|
||||
this.hydrateItemBaseClassCache();
|
||||
}
|
||||
|
||||
if (typeof itemTpl === "undefined")
|
||||
{
|
||||
this.logger.warning("Unable to check itemTpl base class as its undefined");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Edge case - this is the 'root' item that all other items inherit from
|
||||
if (itemTpl === BaseClasses.ITEM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// No item in cache
|
||||
if (!this.itemBaseClassesCache[itemTpl])
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user