File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
browser/main/modals/PreferencesModal Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,14 @@ class SnippetTab extends React.Component {
41
41
42
42
handleSnippetSelect ( snippet ) {
43
43
const { currentSnippet } = this . state
44
- if ( currentSnippet === null || currentSnippet . id !== snippet . id ) {
45
- dataApi . fetchSnippet ( snippet . id ) . then ( changedSnippet => {
46
- // notify the snippet editor to load the content of the new snippet
47
- this . snippetEditor . onSnippetChanged ( changedSnippet )
48
- this . setState ( { currentSnippet : changedSnippet } )
49
- } )
44
+ if ( snippet !== null ) {
45
+ if ( currentSnippet === null || currentSnippet . id !== snippet . id ) {
46
+ dataApi . fetchSnippet ( snippet . id ) . then ( changedSnippet => {
47
+ // notify the snippet editor to load the content of the new snippet
48
+ this . snippetEditor . onSnippetChanged ( changedSnippet )
49
+ this . setState ( { currentSnippet : changedSnippet } )
50
+ } )
51
+ }
50
52
}
51
53
}
52
54
You can’t perform that action at this time.
0 commit comments