Added null check when accessing post text

Этот коммит содержится в:
hmhealey
2015-11-13 11:02:00 -05:00
родитель cb8296a70f
Коммит 4ac5530205

Просмотреть файл

@@ -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
};
};