fix(keycard_pairings): don't write the pairing file if content is empty (#4113)

Fixes https://github.com/status-im/status-desktop/issues/12342
This commit is contained in:
Jonathan Rainville 2023-10-12 16:44:41 -04:00 committed by GitHub
parent ba5ed725ce
commit de34ea37f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ func (kp *KeycardPairings) GetPairingsJSONFileContent() ([]byte, error) {
}
func (kp *KeycardPairings) SetPairingsJSONFileContent(content []byte) error {
if len(content) == 0 {
// Nothing to write
return nil
}
_, err := os.Stat(kp.pairingsFile)
if os.IsNotExist(err) {
dir, _ := filepath.Split(kp.pairingsFile)