Merge pull request #1874 from matrix-org/luke/fix-analytics-crash

Fix crash when browser doesn't report page change measurement
This commit is contained in:
Luke Barnard 2018-05-03 18:46:20 +01:00 committed by GitHub
commit b08abd3d8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -413,6 +413,10 @@ export default React.createClass({
performance.clearMarks('riot_MatrixChat_page_change_start');
performance.clearMarks('riot_MatrixChat_page_change_stop');
const measurement = performance.getEntriesByName('riot_MatrixChat_page_change_delta').pop();
// In practice, sometimes the entries list is empty, so we get no measurement
if (!measurement) return null;
return measurement.duration;
},