Skip to content

Commit a621afa

Browse files
committed
Fix undefined description
1 parent 8684c8c commit a621afa

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

src/routes/Editor/Editor.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,22 @@ class Editor extends React.Component {
103103
};
104104

105105
const { adminToken } = this.props;
106-
if (event.description.includes('<img')) {
107-
const height = event.description.split('height: ').pop().split('px').shift();
108-
const width = event.description.split('width: ').pop().split('px').shift();
109-
if (height >= 800) {
110-
event.description = event.description.replace('height: ' + height, 'height: 800');
111-
}
112-
if (width >= 1000) {
113-
event.description = event.description.replace('width: ' + width, 'width: 1000');
106+
if (typeof event.description !== 'undefined') {
107+
if (event.description.includes('<img')) {
108+
const height = event.description.split('height: ')
109+
.pop()
110+
.split('px')
111+
.shift();
112+
const width = event.description.split('width: ')
113+
.pop()
114+
.split('px')
115+
.shift();
116+
if (height >= 800) {
117+
event.description = event.description.replace('height: ' + height, 'height: 800');
118+
}
119+
if (width >= 1000) {
120+
event.description = event.description.replace('width: ' + width, 'width: 1000');
121+
}
114122
}
115123
}
116124
if (this.props.params.id === 'new') {

0 commit comments

Comments
 (0)