Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix(editor): do not proceed in saveResult() if editor.save() fails (f…
Browse files Browse the repository at this point in the history
…ixes #1463)
  • Loading branch information
itsaky committed Nov 13, 2023
1 parent 6f590a3 commit 93bb303
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,16 @@ open class EditorHandlerActivity : ProjectHandlerActivity(), IEditorHandler {
}

val frag = getEditorAtIndex(index) ?: return
if (frag.file == null) {
return
}
val fileName = frag.file?.name ?: return

run {
// Must be called before frag.save()
// Otherwise, it'll always return false
val modified = frag.isModified
frag.save()
if (!frag.save()) {
return
}

val fileName = frag.file!!.name
val isGradle = fileName.endsWith(".gradle") || fileName.endsWith(".gradle.kts")
val isXml: Boolean = fileName.endsWith(".xml")
if (!result.gradleSaved) {
Expand Down

0 comments on commit 93bb303

Please sign in to comment.