Merge pull request #13661 from danteruiz/avatarapp-undefined-data

fix avatar app from crashing when avatar entity variable is undefined.
This commit is contained in:
Seth Alves 2018-07-23 10:18:31 -07:00 committed by GitHub
commit 4f45fbc5f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)