martinkasa / capacitor-secure-storage-plugin

Capacitor plugin for storing string values securly on iOS and Android.
MIT License
152 stars 53 forks source link

Android SecureStorage.set can not handle null values #49

Closed BreakBB closed 2 years ago

BreakBB commented 2 years ago

On Android the plugin hard crashes when calling await SecureStoragePlugin.set({'someKey', undefined}). This is because of an unhandled NPE that happens when calling value.getBytes:

https://github.com/martinkasa/capacitor-secure-storage-plugin/blob/b4ae3e89ef7b7f2978c6cf50d65cb27740387a53/android/src/main/java/com/whitestein/securestorage/SecureStoragePlugin.java#L81

Funny enough the iOS version already handles possible null values correctly:

https://github.com/martinkasa/capacitor-secure-storage-plugin/blob/acc66a909183907a5db7f393bd48efeb519f8c61/ios/Plugin/Plugin.swift#L15

martinkasa commented 2 years ago

should be fixed in v0.7.0. thank you for reporting