0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 15:22:41 +00:00

Fix snippets crashing in empty brew

If this.props.brew.text is an empty string, it will evaluate to `false` and, but since `isStyle()` is also false, `text` is just undefined.
This commit is contained in:
Trevor Buckner
2021-08-31 11:56:48 -04:00
parent 0e5ed35b6c
commit 13ba5ebcc8
2 changed files with 4 additions and 4 deletions

View File

@@ -69,8 +69,8 @@ const Editor = createClass({
handleInject : function(injectText){
const text = (
this.isText() && this.props.brew.text ||
this.isStyle() && (this.props.brew.style ?? DEFAULT_STYLE_TEXT)
this.isText() ? this.props.brew.text :
this.isStyle() ? this.props.brew.style ?? DEFAULT_STYLE_TEXT : ''
);
const lines = text.split('\n');