Skip to content

Commit

Permalink
Merge pull request #14 from OutSystems/fix/RMET-525-Android9-crash-wi…
Browse files Browse the repository at this point in the history
…th-null-filename-error

RMET-525 :: Android 9 crash with "null filename" error message Fix
  • Loading branch information
andregrillo committed Feb 19, 2021
2 parents 23e009b + 64241f5 commit a33585f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-camera",
"version": "4.2.0-OS",
"version": "4.2.0-OS4",
"description": "Cordova Camera Plugin",
"types": "./types/index.d.ts",
"cordova": {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-camera"
version="4.2.0-OS3">
version="4.2.0-OS4">
<name>Camera</name>
<description>Cordova Camera Plugin</description>
<license>Apache 2.0</license>
Expand Down
9 changes: 9 additions & 0 deletions src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
private static final String GET_All = "Get All";
private static final String CROPPED_URI_KEY = "croppedUri";
private static final String IMAGE_URI_KEY = "imageUri";
private static final String IMAGE_FILE_PATH_KEY = "imageFilePath";

private static final String TAKE_PICTURE_ACTION = "takePicture";

Expand Down Expand Up @@ -1368,6 +1369,10 @@ public Bundle onSaveInstanceState() {
state.putString(IMAGE_URI_KEY, this.imageFilePath);
}

if (this.imageFilePath != null) {
state.putString(IMAGE_FILE_PATH_KEY, this.imageFilePath);
}

return state;
}

Expand All @@ -1393,6 +1398,10 @@ public void onRestoreStateForActivityResult(Bundle state, CallbackContext callba
this.imageUri = Uri.parse(state.getString(IMAGE_URI_KEY));
}

if (state.containsKey(IMAGE_FILE_PATH_KEY)) {
this.imageFilePath = state.getString(IMAGE_FILE_PATH_KEY);
}

this.callbackContext = callbackContext;
}
}

0 comments on commit a33585f

Please sign in to comment.