diff --git a/scripts/shared/native.js b/scripts/shared/native.js index 4d0acd04..2dfd5be7 100644 --- a/scripts/shared/native.js +++ b/scripts/shared/native.js @@ -63,7 +63,10 @@ function isNull(val) { // --------------------------------------------------------------------------- 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) { - return entity.removeData(dataName); + if(entity != null) { + return entity.removeData(dataName); + } + return null; } // --------------------------------------------------------------------------- function doesEntityDataExist(entity, dataName) { - return (entity.getData(dataName) != null); + if(entity != null) { + return (entity.getData(dataName) != null); + } + return null; } // --------------------------------------------------------------------------- \ No newline at end of file