diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-11-13 13:54:58 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-11-13 13:54:58 -0500 |
commit | 47614fb6a8db16c0a93ffe3c35adbbc3a35e6333 (patch) | |
tree | a1e9009da5a6caca325157cd8cf471ad3c5ffc1f /web | |
parent | cb8296a70f390b6e23c2c73f04160933d92b702d (diff) | |
parent | 4ac553020515abb572e80e724ce76c6324c75d40 (diff) | |
download | chat-47614fb6a8db16c0a93ffe3c35adbbc3a35e6333.tar.gz chat-47614fb6a8db16c0a93ffe3c35adbbc3a35e6333.tar.bz2 chat-47614fb6a8db16c0a93ffe3c35adbbc3a35e6333.zip |
Merge pull request #1427 from hmhealey/attachmentnullfix-1.2
(1.2) Added null check when accessing post text
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/post_attachment.jsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web/react/components/post_attachment.jsx b/web/react/components/post_attachment.jsx index 2d6b47f03..cf65dfbfb 100644 --- a/web/react/components/post_attachment.jsx +++ b/web/react/components/post_attachment.jsx @@ -50,7 +50,8 @@ export default class PostAttachment extends React.Component { } shouldCollapse() { - return (this.props.attachment.text.match(/\n/g) || []).length >= 5 || this.props.attachment.text.length > 700; + const text = this.props.attachment.text || ''; + return (text.match(/\n/g) || []).length >= 5 || text.length > 700; } getCollapsedText() { @@ -292,4 +293,4 @@ export default class PostAttachment extends React.Component { PostAttachment.propTypes = { attachment: React.PropTypes.object.isRequired -};
\ No newline at end of file +}; |