From 931f7304063079e92c6de2b6b97e6df7ecf05445 Mon Sep 17 00:00:00 2001 From: b13st Date: Wed, 1 Jul 2026 15:04:26 +0200 Subject: [PATCH] Fix double character deletion causing crash on HCE transfer to VitalWear Character was deleted from the local DB both right after sendCharacterToWatch and again in WritingScreen's completion callback. The second deletion failed because the character no longer existed, causing the reported random crash when sending back to the watch. Deletion is now handled only once, in WritingScreen. --- .../vbhelper/screens/scanScreen/ScanScreenControllerImpl.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/nacabaro/vbhelper/screens/scanScreen/ScanScreenControllerImpl.kt b/app/src/main/java/com/github/nacabaro/vbhelper/screens/scanScreen/ScanScreenControllerImpl.kt index 32ca62e..73043bb 100644 --- a/app/src/main/java/com/github/nacabaro/vbhelper/screens/scanScreen/ScanScreenControllerImpl.kt +++ b/app/src/main/java/com/github/nacabaro/vbhelper/screens/scanScreen/ScanScreenControllerImpl.kt @@ -231,9 +231,7 @@ class ScanScreenControllerImpl( val proto = VitalWearCharacterExporter(componentActivity, database).buildCharacterProto(characterId) val client = VitalWearHceReaderClient(isoDep) client.sendCharacterToWatch(proto) - database.userCharacterDao().deleteCharacterById(characterId) - pendingExportCharacterId = null - Log.i("NFC_WRITE", "Character sent to VitalWear and deleted from app (id=$characterId)") + Log.i("NFC_WRITE", "Character sent to VitalWear (id=$characterId), deletion deferred to WritingScreen") componentActivity.runOnUiThread { Toast.makeText(componentActivity, componentActivity.getString(R.string.scan_sent_character_success), Toast.LENGTH_SHORT).show() }