Skip to content

Commit d2f8e26

Browse files
committed
fix bug where last-file config option was undefined on reinstall causing crash - found by @urbantumbleweed
1 parent f7bb39c commit d2f8e26

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

plugins/sidebar/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ function sidebar(app, opts, done){
110110
const lastFile = userConfig.get('last-file');
111111
console.log(lastFile);
112112
space.changeDir(cwd, () => {
113-
loadFile(lastFile);
113+
if(lastFile){
114+
loadFile(lastFile);
115+
} else {
116+
newFile();
117+
}
114118
done();
115119
});
116120

src/stores/file.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ class FileStore {
163163
}
164164

165165
onLoadFile(filename){
166+
if(!filename){
167+
return;
168+
}
169+
166170
const { workspace, userConfig } = this.getInstance();
167171
const { isNewFile } = this.state;
168172

0 commit comments

Comments
 (0)