Issue 521, avoid an NPE

git-svn-id: https://zxing.googlecode.com/svn/trunk@1552 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-08-22 21:58:11 +00:00
parent ca1cf153d6
commit 273d2eea97

View file

@ -151,6 +151,10 @@ public final class ShareActivity extends Activity {
}
private void showTextAsBarcode(String text) {
Log.i(TAG, "Showing text as barcode: " + text);
if (text == null) {
return; // Show error?
}
Intent intent = new Intent(Intents.Encode.ACTION);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Intents.Encode.TYPE, Contents.Type.TEXT);
@ -167,6 +171,9 @@ public final class ShareActivity extends Activity {
*/
private void showContactAsBarcode(Uri contactUri) {
Log.i(TAG, "Showing contact URI as barcode: " + contactUri);
if (contactUri == null) {
return; // Show error?
}
ContentResolver resolver = getContentResolver();
Cursor contactCursor = resolver.query(contactUri, null, null, null, null);
Bundle bundle = new Bundle();