Skip to content

Commit e42b0ff

Browse files
committed
fix(snippet): handle null scratch file creation
Add null check for scratch file creation and
1 parent d31d13a commit e42b0ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/snippet/AutoDevRunAction.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class AutoDevRunAction : DumbAwareAction() {
3939

4040
val scratchFile = ScratchRootType.getInstance()
4141
.createScratchFile(project, file.name, psiFile.language, document.text)
42-
?: return
42+
43+
if (scratchFile == null) {
44+
AutoDevNotifications.warn(project, "Cannot create scratch file")
45+
return
46+
}
4347

4448
if (scratchFile.extension == "sh") {
4549
File(scratchFile.path).setExecutable(true)

0 commit comments

Comments
 (0)