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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user