Fix crash when content is empty map

This commit is contained in:
Roman Hotsiy 2017-11-21 16:42:40 +02:00
parent 5b3964e55b
commit 0ab1c71cb6
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -23,7 +23,7 @@ export class MediaTypesSwitch extends React.Component<MediaTypesSwitchProps> {
render() {
const { content } = this.props;
if (!content || !content.mediaTypes) return null;
if (!content || !content.mediaTypes || !content.mediaTypes.length) return null;
const activeMimeIdx = content.activeMimeIdx;
let options = content.mediaTypes.map((mime, idx) => {