From fddc777de09b63c6309453a40b0f11739f629675 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 21 Dec 2020 23:41:17 -0600 Subject: [PATCH] Fix for null elements --- scripts/shared/native.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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