CB-919: Camera Plugin returned with empty error message

Guarding against null cursor.
This commit is contained in:
macdonst 2012-06-20 12:20:37 -04:00
parent a691e9f744
commit c1c9075962
2 changed files with 21 additions and 17 deletions

View File

@ -524,6 +524,7 @@ public class CameraLauncher extends Plugin {
private void checkForDuplicateImage(int type) { private void checkForDuplicateImage(int type) {
int diff = 1; int diff = 1;
Cursor cursor = queryImgDB(); Cursor cursor = queryImgDB();
if (cursor != null) {
int currentNumOfImages = cursor.getCount(); int currentNumOfImages = cursor.getCount();
if (type == FILE_URI) { if (type == FILE_URI) {
@ -538,6 +539,7 @@ public class CameraLauncher extends Plugin {
this.cordova.getActivity().getContentResolver().delete(uri, null, null); this.cordova.getActivity().getContentResolver().delete(uri, null, null);
} }
} }
}
/** /**
* Compress bitmap using jpeg, convert to Base64 encoded string, and return to JavaScript. * Compress bitmap using jpeg, convert to Base64 encoded string, and return to JavaScript.

View File

@ -424,6 +424,7 @@ public class Capture extends Plugin {
*/ */
private void checkForDuplicateImage() { private void checkForDuplicateImage() {
Cursor cursor = queryImgDB(); Cursor cursor = queryImgDB();
if (cursor != null) {
int currentNumOfImages = cursor.getCount(); int currentNumOfImages = cursor.getCount();
// delete the duplicate file if the difference is 2 // delete the duplicate file if the difference is 2
@ -434,4 +435,5 @@ public class Capture extends Plugin {
this.cordova.getActivity().getContentResolver().delete(uri, null, null); this.cordova.getActivity().getContentResolver().delete(uri, null, null);
} }
} }
}
} }