Skip to content

Commit 9eacc57

Browse files
fix entity server crash
1 parent e77a460 commit 9eacc57

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

libraries/entities/src/EntityItem.h.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@ public:
452452
_updateScriptUserDataOperator = updateScriptUserDataOperator;
453453
}
454454
static void updateScriptUserData(const EntityItemID& entityID, const QString& scriptURL, const QString& userData) {
455-
_updateScriptUserDataOperator(entityID, scriptURL, userData);
455+
if (_updateScriptUserDataOperator) {
456+
_updateScriptUserDataOperator(entityID, scriptURL, userData);
457+
}
456458
}
457459

458460
signals:

libraries/entities/src/ScriptEntityItem.cpp.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,18 @@ bool ScriptEntityItem::getEnabled() const {
197197
}
198198

199199
void ScriptEntityItem::updateScript() {
200+
const auto tree = getTree();
201+
if (!tree) {
202+
_updateNeeded = true;
203+
return;
204+
}
205+
206+
// We only support client-side Script entities for now
207+
if (!tree->getIsClient()) {
208+
_updateNeeded = false;
209+
return;
210+
}
211+
200212
QUuid parentID = getParentID();
201213
QUuid runningParentID;
202214
QString runningScriptURL;

0 commit comments

Comments
 (0)