Add check for null entity in new data util

This commit is contained in:
Vortrex
2020-12-18 19:06:39 -06:00
parent cfdf58dfb3
commit 92f50b51fa

View File

@@ -69,10 +69,12 @@ function getEntityData(entity, dataName) {
// ---------------------------------------------------------------------------
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
if(!isNull(server)) {
return entity.setData(dataName, dataValue, syncToClients);
} else {
return entity.setData(dataName, dataValue);
if(entity != null) {
if(!isNull(server)) {
return entity.setData(dataName, dataValue, syncToClients);
} else {
return entity.setData(dataName, dataValue);
}
}
}