From ce3922a3c1e7bc52e8ea24ddda584235eea56709 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Fri, 20 Jul 2018 11:23:02 -0700 Subject: [PATCH 1/2] fix avatarEntities undefined crash --- scripts/system/avatarapp.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index f692128fa3..1f07813d46 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -159,13 +159,12 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See for(var bookmarkName in message.data.bookmarks) { var bookmark = message.data.bookmarks[bookmarkName]; - if (!bookmark.avatarEntites) { // ensure avatarEntites always exist - bookmark.avatarEntites = []; - } - bookmark.avatarEntites.forEach(function(avatarEntity) { - avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) - }) + if (bookmark.avatarEntites) { + bookmark.avatarEntites.forEach(function(avatarEntity) { + avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) + }); + } } sendToQml(message) From 9bf6cff5cd9a2cdf31f8781c34b9a046eaafe361 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Fri, 20 Jul 2018 12:27:51 -0700 Subject: [PATCH 2/2] fix indent isssues --- scripts/system/avatarapp.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index 1f07813d46..2162b78721 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -160,11 +160,11 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See for(var bookmarkName in message.data.bookmarks) { var bookmark = message.data.bookmarks[bookmarkName]; - if (bookmark.avatarEntites) { - bookmark.avatarEntites.forEach(function(avatarEntity) { - avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation) - }); - } + if (bookmark.avatarEntites) { + bookmark.avatarEntites.forEach(function(avatarEntity) { + avatarEntity.properties.localRotationAngles = Quat.safeEulerAngles(avatarEntity.properties.localRotation); + }); + } } sendToQml(message)