cordova-plugin-camera
cordova-plugin-camera copied to clipboard
fix(android): close cursors to suppress log warnings
Platforms affected
Android
Motivation and Context
- "W/System: A resource failed to call close" is logged whenever a Cursor object is left unclosed in this file.
android.content.ContentResolver.queryreturns:
A Cursor object, which is positioned before the first entry. May return null if the underlying content provider returns null, or if it crashes.
So we should check for null Cursors after running queryImgDB
Description
- Added null checks before running functions on Cursor objects.
- Close all cursor objects after they have been created and used.
Testing
I ran an app using this plugin in debug mode through Android Studio and confirmed the warnings no longer appear after these changes have been made.