Commit 345afddc authored by Harrison Healey's avatar Harrison Healey

MM-13176 Fix error when previewing a message (#2106)

parent 1a0d0ff5
......@@ -71,7 +71,7 @@ export default class PostMarkdown extends React.PureComponent {
proxyImages={proxyImages}
options={this.props.options}
channelNamesMap={channelNamesMap}
imagesMetadata={this.props.post.metadata && this.props.post.metadata.images}
imagesMetadata={this.props.post && this.props.post.metadata && this.props.post.metadata.images}
/>
);
}
......
......@@ -15,6 +15,13 @@ describe('components/PostMarkdown', () => {
post: {},
};
test('should not error when rendering without a post', () => {
const props = {...baseProps};
Reflect.deleteProperty(props, 'post');
shallow(<PostMarkdown {...props}/>);
});
test('should render properly with an empty post', () => {
const wrapper = shallow(
<PostMarkdown {...baseProps}/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment