From 0cd34227cc485aa5603b059168a181a0299b6f4a Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 28 Feb 2017 10:24:16 -0500 Subject: [PATCH] Fix JS error from some link previews (#5556) --- .../post_view/components/post_attachment_opengraph.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/components/post_view/components/post_attachment_opengraph.jsx b/webapp/components/post_view/components/post_attachment_opengraph.jsx index 20beaed511..b83150839a 100644 --- a/webapp/components/post_view/components/post_attachment_opengraph.jsx +++ b/webapp/components/post_view/components/post_attachment_opengraph.jsx @@ -81,6 +81,10 @@ export default class PostAttachmentOpenGraph extends React.Component { } getBestImageUrl() { + if (this.state.data.images == null) { + return null; + } + const nearestPointData = CommonUtils.getNearestPoint(this.imageDimentions, this.state.data.images, 'width', 'height'); const bestImage = nearestPointData.nearestPoint;