Fixed bug with tools
Created by: RobinKavPA
Fixed error occurring when data[0].relatedObjects was empty - it was actually null, not undefined so the array was never instantiated. Refactored to use ES6 spread operator and default empty array.
if (typeof data[0].relatedObjects === 'undefined') data[0].relatedObjects = []; data[0].relatedObjects.push({