Skip to content

Commit 5a90463

Browse files
authored
fix: Prevent error when removing non-existent key from MMKV (#6405)
1 parent 612d4c1 commit 5a90463

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/lib/methods/userPreferences.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ class UserPreferences {
5252
}
5353

5454
removeItem(key: string): boolean | undefined {
55-
return this.mmkv.removeItem(key) ?? undefined;
55+
if (this.getString(key) !== null) {
56+
return this.mmkv.removeItem(key) ?? undefined;
57+
}
58+
return false;
5659
}
5760
}
5861

0 commit comments

Comments
 (0)