mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-14 20:23:05 +08:00
CB-4471: Mitigating Android 4.3 errors where data isn't being passed so NPE doesn't happen
This commit is contained in:
parent
cb11486f66
commit
cdb49eaa1f
@ -305,8 +305,13 @@ public class Capture extends CordovaPlugin {
|
|||||||
// Get the uri of the video clip
|
// Get the uri of the video clip
|
||||||
Uri data = intent.getData();
|
Uri data = intent.getData();
|
||||||
// create a file object from the uri
|
// create a file object from the uri
|
||||||
|
if(data == null)
|
||||||
|
{
|
||||||
|
this.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
results.put(createMediaFile(data));
|
results.put(createMediaFile(data));
|
||||||
|
|
||||||
if (results.length() >= limit) {
|
if (results.length() >= limit) {
|
||||||
// Send Uri back to JavaScript for viewing video
|
// Send Uri back to JavaScript for viewing video
|
||||||
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
|
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, results));
|
||||||
@ -316,6 +321,7 @@ public class Capture extends CordovaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If canceled
|
// If canceled
|
||||||
else if (resultCode == Activity.RESULT_CANCELED) {
|
else if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
// If we have partial results send them back to the user
|
// If we have partial results send them back to the user
|
||||||
|
Loading…
Reference in New Issue
Block a user