cordova-plugin-media-capture
cordova-plugin-media-capture copied to clipboard
Android: Prevent app crash caused by NPE on intent data or mediaFile
Platforms affected
Android
Motivation and Context
Prevent app crash after capture and show error if no content or no access to it
Description
- minimal fix #227
Unify null checks for all three capture types, first on retrieved intent data uri (failing with
CAPTURE_NO_MEDIA_FILES
), and then on no mediaFile created (failing withCAPTURE_INTERNAL_ERR
) - Simplify how video uri is retrieved from Video capture intent (see #210 comment)
Testing
App crashing because of audio capture in some conditions (see #227 comment) now resolves with failure instead. Not perfect, expecting #215 work on FileProvider to solve the problem but for now it is not an app crash anymore.
Checklist
- [x] I've run the tests to see all new and existing tests pass
- [x] I added automated test coverage as appropriate for this change
- [x] Commit is prefixed with
(platform)
if this change only applies to one platform (e.g.(android)
) - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
- [x] I've updated the documentation if necessary