PasswordCreationActivity: properly guard rename code

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya
2020-06-21 02:21:44 +05:30
committed by Fabian Henneke
parent 2c6d4548c5
commit a0b6f48b50

View File

@@ -286,7 +286,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
}
}
if (category.isVisible && category.isEnabled) {
if (category.isVisible && category.isEnabled && oldFileName != null) {
val oldFile = File("$repoPath/${oldCategory?.trim('/')}/$oldFileName.gpg")
if (oldFile.path != file.path && !oldFile.delete()) {
setResult(RESULT_CANCELED)