Fix for null elements

This commit is contained in:
Vortrex
2020-12-21 23:41:17 -06:00
parent 9ce5a45822
commit fddc777de0

View File

@@ -63,7 +63,10 @@ function isNull(val) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function getEntityData(entity, dataName) { function getEntityData(entity, dataName) {
return entity.getData(dataName); if(entity != null) {
return entity.getData(dataName);
}
return null;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -81,13 +84,19 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function removeEntityData(entity, dataName) { function removeEntityData(entity, dataName) {
return entity.removeData(dataName); if(entity != null) {
return entity.removeData(dataName);
}
return null;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function doesEntityDataExist(entity, dataName) { function doesEntityDataExist(entity, dataName) {
return (entity.getData(dataName) != null); if(entity != null) {
return (entity.getData(dataName) != null);
}
return null;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------